bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1614738 - in /bval/branches/bval-11: bval-jsr/src/main/java/org/apache/bval/cdi/ bval-tck11/ bval-tck11/src/main/java/org/apache/bval/arquillian/
Date Wed, 30 Jul 2014 18:46:15 GMT
Author: rmannibucau
Date: Wed Jul 30 18:46:15 2014
New Revision: 1614738

URL: http://svn.apache.org/r1614738
Log:
using owb snapshot since it targets a cdi 1.1 + fixing the fact BValInterceptor is always
added - TODO: surely make it optional using a beans.xml cnofigured to skip default behavior
but needs more discussion

Removed:
    bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/CdiMethodValidationProcessor.java
Modified:
    bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java
    bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorBean.java
    bval/branches/bval-11/bval-tck11/pom.xml
    bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/BValArquillianExtension.java
    bval/branches/bval-11/bval-tck11/work-tests-suite.xml

Modified: bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java?rev=1614738&r1=1614737&r2=1614738&view=diff
==============================================================================
--- bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java (original)
+++ bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java Wed
Jul 30 18:46:15 2014
@@ -18,8 +18,6 @@
  */
 package org.apache.bval.cdi;
 
-import org.apache.bval.jsr.parameter.DefaultParameterNameProvider;
-
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.spi.AfterBeanDiscovery;
@@ -243,17 +241,14 @@ public class BValExtension implements Ex
                 if (validatorFactoryFound) {
                     factory = config.buildValidatorFactory();
                 } // else fresh factory already created in previous if
-                afterBeanDiscovery.addBean(new ValidatorBean(factory.getValidator()));
+                afterBeanDiscovery.addBean(new ValidatorBean(factory, factory.getValidator()));
                 validatorFound = true;
             } catch (final Exception e) { // getValidator can throw an exception with custom
providers
+                afterBeanDiscovery.addBean(new ValidatorBean(factory, null));
+                validatorFound = true;
                 LOGGER.log(Level.SEVERE, e.getMessage(), e);
             }
         }
-
-        // add our interceptor, after having added validator if needed since it is injected
in the interceptor
-        if (validatorFound) {
-            afterBeanDiscovery.addBean(new BValInterceptorBean(beanManager));
-        } // else we couldn't resolve the interceptor injection point
     }
 
     private static ClassLoader loader() {

Modified: bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorBean.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorBean.java?rev=1614738&r1=1614737&r2=1614738&view=diff
==============================================================================
--- bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorBean.java (original)
+++ bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorBean.java Wed
Jul 30 18:46:15 2014
@@ -24,6 +24,7 @@ import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.PassivationCapable;
 import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.util.Collections;
@@ -33,9 +34,11 @@ import java.util.Set;
 public class ValidatorBean implements Bean<Validator> , PassivationCapable{
     private final Set<Type> types;
     private final Set<Annotation> qualifiers;
-    private final Validator instance;
+    private final ValidatorFactory factory;
+    private volatile Validator instance;
 
-    public ValidatorBean(Validator validator) {
+    public ValidatorBean(final ValidatorFactory factory, final Validator validator) {
+        this.factory = factory;
         this.instance = validator;
 
         types = new HashSet<Type>();
@@ -84,6 +87,13 @@ public class ValidatorBean implements Be
     }
 
     public Validator create(final CreationalContext<Validator> context) {
+        if (instance == null) {
+            synchronized (this) {
+                if (instance == null) {
+                    instance = factory.getValidator();
+                }
+            }
+        }
         return instance;
     }
 

Modified: bval/branches/bval-11/bval-tck11/pom.xml
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-tck11/pom.xml?rev=1614738&r1=1614737&r2=1614738&view=diff
==============================================================================
--- bval/branches/bval-11/bval-tck11/pom.xml (original)
+++ bval/branches/bval-11/bval-tck11/pom.xml Wed Jul 30 18:46:15 2014
@@ -34,7 +34,7 @@ under the License.
 
     <properties>
         <tck.version>1.1.0.Final</tck.version>
-        <owb.version>1.2.1</owb.version>
+        <owb.version>2.0.0-SNAPSHOT</owb.version>
         <arquillian.version>1.0.3.Final</arquillian.version>
         <validation.provider>org.apache.bval.jsr.ApacheValidationProvider</validation.provider>
     </properties>
@@ -100,7 +100,7 @@ under the License.
         </dependency>
         <dependency>
             <groupId>org.apache.openwebbeans</groupId>
-            <artifactId>openwebbeans-cdi11-preview</artifactId>
+            <artifactId>openwebbeans-impl</artifactId>
             <version>${owb.version}</version>
             <scope>test</scope>
         </dependency>

Modified: bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/BValArquillianExtension.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/BValArquillianExtension.java?rev=1614738&r1=1614737&r2=1614738&view=diff
==============================================================================
--- bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/BValArquillianExtension.java
(original)
+++ bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/BValArquillianExtension.java
Wed Jul 30 18:46:15 2014
@@ -18,13 +18,11 @@
  */
 package org.apache.bval.arquillian;
 
-import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
 import org.jboss.arquillian.core.spi.LoadableExtension;
 import org.jboss.arquillian.test.spi.TestEnricher;
 
 public class BValArquillianExtension implements LoadableExtension {
     public void register(final ExtensionBuilder builder) {
-        builder.service(TestEnricher.class, EJBEnricher.class)
-            .service(ApplicationArchiveProcessor.class, CdiMethodValidationProcessor.class);
+        builder.service(TestEnricher.class, EJBEnricher.class);
     }
 }

Modified: bval/branches/bval-11/bval-tck11/work-tests-suite.xml
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-tck11/work-tests-suite.xml?rev=1614738&r1=1614737&r2=1614738&view=diff
==============================================================================
--- bval/branches/bval-11/bval-tck11/work-tests-suite.xml (original)
+++ bval/branches/bval-11/bval-tck11/work-tests-suite.xml Wed Jul 30 18:46:15 2014
@@ -21,7 +21,7 @@ think to add -Dvalidation.provider=org.a
 <suite name="tmp" verbose="1">
   <test name="tmp">
     <classes>
-      <class name="org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest">
+      <class name="org.hibernate.beanvalidation.tck.tests.bootstrap.customprovider.BootstrapCustomProviderDefinedInServiceFileTest">
         <methods>
 
         </methods>



Mime
View raw message