openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1797401 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/java/org/apache/webbeans/util/ webbeans-impl/src/test/java...
Date Fri, 02 Jun 2017 15:21:01 GMT
Author: rmannibucau
Date: Fri Jun  2 15:21:01 2017
New Revision: 1797401

URL: http://svn.apache.org/viewvc?rev=1797401&view=rev
Log:
passing unproxyable test of CDI 2 suite

Added:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/UnproxyableBean.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/InjectionExceptionUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/definition/proxyable/ProxyableBeanTypeTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerPassivationTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/unproxyable/AllowProxyingTest.java
    openwebbeans/trunk/webbeans-tck/standalone-suite.xml
    openwebbeans/trunk/webbeans-tck/testng-dev.xml

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java?rev=1797401&r1=1797400&r2=1797401&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java
Fri Jun  2 15:21:01 2017
@@ -18,7 +18,6 @@
  */
 package org.apache.webbeans.component.creation;
 
-import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.UnproxyableResolutionException;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.BeanAttributes;
@@ -76,29 +75,4 @@ public class ManagedBeanBuilder<T, M ext
         }
         return (M) new UnproxyableBean<T>(webBeansContext, WebBeansType.MANAGED, beanAttributes,
annotatedType, annotatedType.getJavaClass(), lazyException);
     }
-
-    private static class UnproxyableBean<T> extends ManagedBean<T>
-    {
-        private final UnproxyableResolutionException exception;
-
-        public UnproxyableBean(final WebBeansContext webBeansContext, final WebBeansType
webBeansType,
-                               final BeanAttributes<T> beanAttributes, final AnnotatedType<T>
at, final Class<T> beanClass,
-                               final UnproxyableResolutionException error)
-        {
-            super(webBeansContext, webBeansType, at, beanAttributes, beanClass);
-            this.exception = error;
-        }
-
-        @Override
-        public boolean valid()
-        {
-            throw exception;
-        }
-
-        @Override
-        public T create(final CreationalContext<T> creationalContext)
-        {
-            throw exception;
-        }
-    }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java?rev=1797401&r1=1797400&r2=1797401&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java
Fri Jun  2 15:21:01 2017
@@ -24,6 +24,7 @@ import java.util.HashSet;
 import java.util.Set;
 
 import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.UnproxyableResolutionException;
 import javax.enterprise.inject.spi.AnnotatedField;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.inject.Named;
@@ -107,10 +108,15 @@ public class ProducerFieldBeansBuilder<T
                     ProcessBeanAttributesImpl<T> processBeanAttributes = fireProcessBeanAttributes(annotatedField);
 
                     ProducerFieldBeanBuilder<T, ProducerFieldBean<T>> producerFieldBeanCreator
-                        = new ProducerFieldBeanBuilder<T, ProducerFieldBean<T>>(bean,
annotatedField, processBeanAttributes.getAttributes());
+                        = new ProducerFieldBeanBuilder<>(bean, annotatedField, processBeanAttributes.getAttributes());
                     ProducerFieldBean<T> producerFieldBean = producerFieldBeanCreator.getBean();
 
-                    webBeansContext.getDeploymentValidationService().validateProxyable(producerFieldBean,
processBeanAttributes.isIgnoreFinalMethods());
+                    final UnproxyableResolutionException lazyException = webBeansContext.getDeploymentValidationService()
+                            .validateProxyable(producerFieldBean, processBeanAttributes.isIgnoreFinalMethods());
+                    if (lazyException != null) // should we use UnproxyableBean there too?
if not required by TCK, better to fail eagerly
+                    {
+                        throw lazyException;
+                    }
                     producerFieldBeanCreator.validate();
 
                     producerFieldBean.setProducerField(field);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java?rev=1797401&r1=1797400&r2=1797401&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
Fri Jun  2 15:21:01 2017
@@ -33,6 +33,7 @@ import javax.enterprise.event.ObservesAs
 import javax.enterprise.inject.Disposes;
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.Specializes;
+import javax.enterprise.inject.UnproxyableResolutionException;
 import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.inject.Inject;
@@ -98,8 +99,12 @@ public class ProducerMethodBeansBuilder<
 
                     ProducerMethodBean<T> producerMethodBean = producerMethodBeanCreator.getBean();
 
-                    //X TODO validateProxyable returns the exception, throw the returned
exception??
-                    webBeansContext.getDeploymentValidationService().validateProxyable(producerMethodBean,
processBeanAttributes.isIgnoreFinalMethods());
+                    final UnproxyableResolutionException lazyException = webBeansContext.getDeploymentValidationService()
+                            .validateProxyable(producerMethodBean, processBeanAttributes.isIgnoreFinalMethods());
+                    if (lazyException != null) // should we use UnproxyableBean there too?
if not required by TCK, better to fail eagerly
+                    {
+                        throw lazyException;
+                    }
                     producerMethodBeanCreator.validate();
 
                     if(specialize)

Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/UnproxyableBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/UnproxyableBean.java?rev=1797401&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/UnproxyableBean.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/UnproxyableBean.java
Fri Jun  2 15:21:01 2017
@@ -0,0 +1,53 @@
+/*
+ * 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.component.creation;
+
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.WebBeansContext;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.UnproxyableResolutionException;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanAttributes;
+
+class UnproxyableBean<T> extends ManagedBean<T>
+{
+    private final UnproxyableResolutionException exception;
+
+    UnproxyableBean(final WebBeansContext webBeansContext, final WebBeansType webBeansType,
+                           final BeanAttributes<T> beanAttributes, final AnnotatedType<T>
at, final Class<T> beanClass,
+                           final UnproxyableResolutionException error)
+    {
+        super(webBeansContext, webBeansType, at, beanAttributes, beanClass);
+        this.exception = error;
+    }
+
+    @Override
+    public boolean valid()
+    {
+        throw exception;
+    }
+
+    @Override
+    public T create(final CreationalContext<T> creationalContext)
+    {
+        throw exception;
+    }
+}

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java?rev=1797401&r1=1797400&r2=1797401&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
Fri Jun  2 15:21:01 2017
@@ -19,7 +19,6 @@
 package org.apache.webbeans.config;
 
 import static org.apache.webbeans.util.InjectionExceptionUtil.createUnproxyableResolutionException;
-import static org.apache.webbeans.util.InjectionExceptionUtil.throwUnproxyableResolutionException;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
@@ -139,10 +138,9 @@ public class DeploymentValidationService
                     }
                 }
 
-                //Throw Exception
                 if(violationMessage.containsViolation())
                 {
-                    throwUnproxyableResolutionException(violationMessage);
+                    return createUnproxyableResolutionException(violationMessage);
                 }
             }
         }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/InjectionExceptionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/InjectionExceptionUtil.java?rev=1797401&r1=1797400&r2=1797401&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/InjectionExceptionUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/InjectionExceptionUtil.java
Fri Jun  2 15:21:01 2017
@@ -36,11 +36,6 @@ public class InjectionExceptionUtil
         // utility class ct
     }
 
-    public static void throwUnproxyableResolutionException(ViolationMessageBuilder violationMessage)
-    {
-        throw createUnproxyableResolutionException(violationMessage);
-    }
-
     public static UnproxyableResolutionException createUnproxyableResolutionException(ViolationMessageBuilder
violationMessage)
     {
         return new UnproxyableResolutionException(

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/definition/proxyable/ProxyableBeanTypeTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/definition/proxyable/ProxyableBeanTypeTest.java?rev=1797401&r1=1797400&r2=1797401&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/definition/proxyable/ProxyableBeanTypeTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/definition/proxyable/ProxyableBeanTypeTest.java
Fri Jun  2 15:21:01 2017
@@ -19,14 +19,9 @@
 package org.apache.webbeans.test.definition.proxyable;
 
 
-import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.test.AbstractUnitTest;
 import org.apache.webbeans.test.definition.proxyable.beans.BaseClassWithPublicFinalMethod;
 import org.apache.webbeans.test.definition.proxyable.beans.BeanWithPrivateFinalMethod;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
 import org.apache.webbeans.test.definition.proxyable.beans.BeanWithPublicFinalMethod;
 import org.apache.webbeans.test.definition.proxyable.beans.DependentBeanWithoutDefaultCt;
 import org.apache.webbeans.test.definition.proxyable.beans.NonAbstractSubClassBean;
@@ -34,6 +29,10 @@ import org.apache.webbeans.test.definiti
 import org.junit.Assert;
 import org.junit.Test;
 
+import javax.enterprise.inject.UnproxyableResolutionException;
+import java.util.ArrayList;
+import java.util.Collection;
+
 /**
  * This test checks for various conditions about NormalScope
  * Bean criteria regarding the ability to proxy those classes.
@@ -65,16 +64,18 @@ public class ProxyableBeanTypeTest exten
 
     }
 
-    @Test(expected = WebBeansConfigurationException.class)
+    @Test(expected = UnproxyableResolutionException.class)
     public void testBeanWithPublicFinalMethods()
     {
         startContainer(BeanWithPublicFinalMethod.class);
+        getInstance(BeanWithPublicFinalMethod.class);
     }
 
-    @Test(expected = WebBeansConfigurationException.class)
+    @Test(expected = UnproxyableResolutionException.class)
     public void testSubclassBeanWithPublicFinalMethods()
     {
         startContainer(SubClassWithNormalScope.class, BaseClassWithPublicFinalMethod.class);
+        getInstance(SubClassWithNormalScope.class);
     }
 
     @Test

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerPassivationTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerPassivationTest.java?rev=1797401&r1=1797400&r2=1797401&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerPassivationTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerPassivationTest.java
Fri Jun  2 15:21:01 2017
@@ -16,6 +16,10 @@
  */
 package org.apache.webbeans.test.producer;
 
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Test;
+
 import javax.enterprise.context.Dependent;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.inject.Produces;
@@ -23,10 +27,6 @@ import javax.enterprise.inject.spi.Defin
 import javax.inject.Inject;
 import java.io.Serializable;
 
-import org.junit.Assert;
-import org.apache.webbeans.test.AbstractUnitTest;
-import org.junit.Test;
-
 /**
  * Tests passivation capability detection for producerMethods
  */

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/unproxyable/AllowProxyingTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/unproxyable/AllowProxyingTest.java?rev=1797401&r1=1797400&r2=1797401&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/unproxyable/AllowProxyingTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/unproxyable/AllowProxyingTest.java
Fri Jun  2 15:21:01 2017
@@ -19,6 +19,7 @@ package org.apache.webbeans.test.proxy.u
 import javax.enterprise.context.Dependent;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.UnproxyableResolutionException;
 import javax.enterprise.inject.spi.DefinitionException;
 import javax.inject.Inject;
 import java.util.HashMap;
@@ -41,7 +42,7 @@ public class AllowProxyingTest extends A
     }
 
 
-    @Test(expected = DefinitionException.class)
+    @Test(expected = UnproxyableResolutionException.class)
     public void testNonProxyableException()
     {
         startContainer(SomeClassWithFinalMethods.class);

Modified: openwebbeans/trunk/webbeans-tck/standalone-suite.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/standalone-suite.xml?rev=1797401&r1=1797400&r2=1797401&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/standalone-suite.xml (original)
+++ openwebbeans/trunk/webbeans-tck/standalone-suite.xml Fri Jun  2 15:21:01 2017
@@ -116,11 +116,6 @@
                 <methods><exclude name=".*"/></methods>
             </class>
 
-            <!-- https://issues.jboss.org/browse/CDITCK-584 -->
-            <class name="org.jboss.cdi.tck.tests.implementation.simple.lifecycle.unproxyable.UnproxyableManagedBeanTest">
-                <methods><exclude name=".*"/></methods>
-            </class>
-
             <!-- https://issues.jboss.org/browse/CDITCK-586 -->
             <class name="org.jboss.cdi.tck.tests.event.observer.async.basic.MixedObserversTest">
                 <methods><exclude name="testAsyncObserversCalledInDifferentThread"/></methods>

Modified: openwebbeans/trunk/webbeans-tck/testng-dev.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/testng-dev.xml?rev=1797401&r1=1797400&r2=1797401&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/testng-dev.xml (original)
+++ openwebbeans/trunk/webbeans-tck/testng-dev.xml Fri Jun  2 15:21:01 2017
@@ -18,7 +18,9 @@
 <suite name="JSR-346-TCK" verbose="2" configfailurepolicy="continue">
   <test name="JSR-346 TCK">
     <classes>
-          <class name="org.jboss.cdi.tck.tests.event.observer.async.handlingExceptions.MultipleExceptionsInObserversNotificationTest"
/>
+          <class name="org.jboss.cdi.tck.tests.extensions.lifecycle.processBeanAttributes.specialization.VetoTest"
/>
+          <class name="org.jboss.cdi.tck.tests.implementation.simple.lifecycle.unproxyable.UnproxyableManagedBeanTest"
/>
+          <class name="org.jboss.cdi.tck.tests.context.passivating.broken.producer.field.managed.NonPassivationCapableProducerFieldTest"
/>
       <!--
       <class name="org.jboss.cdi.tck.tests.event.parameterized.ParameterizedEventTest"
/>
       <class name="org.jboss.cdi.tck.tests.event.fires.FireEventTest" />



Mime
View raw message