You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by jo...@apache.org on 2013/06/12 15:00:44 UTC

[2/3] git commit: DELTASPIKE-332 Introduce basic bean val support; ability to add a CDI aware validator factory.

DELTASPIKE-332 Introduce basic bean val support; ability to add a CDI aware validator factory.


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/2ed57df7
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/2ed57df7
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/2ed57df7

Branch: refs/heads/master
Commit: 2ed57df7df256b407f6011136bfadd6ae6b80466
Parents: 4b636c8
Author: John D. Ament <jo...@gmail.com>
Authored: Tue Jun 11 21:26:27 2013 -0400
Committer: John D. Ament <jo...@gmail.com>
Committed: Tue Jun 11 21:26:27 2013 -0400

----------------------------------------------------------------------
 deltaspike/modules/beanval/api/pom.xml          |   33 +
 deltaspike/modules/beanval/api/pom.xml~         |   53 +
 deltaspike/modules/beanval/impl/pom.xml         |   47 +
 deltaspike/modules/beanval/impl/pom.xml~        |   97 ++
 .../CDIAwareConstraintValidatorFactory.java     |   68 ++
 .../deltaspike/beanval/test/ArchiveUtils.java   |   32 +
 .../deltaspike/beanval/test/ArrayChecker.java   |   29 +
 .../deltaspike/beanval/test/ArraySize.java      |   46 +
 .../deltaspike/beanval/test/BasicPojo.java      |   36 +
 .../test/InjectableConstraintValidator.java     |   45 +
 .../beanval/test/InjectedValidationTest.java    |   78 ++
 .../impl/src/test/resources/arquillian.xml      |   84 ++
 .../impl/src/test/resources/validation.xml      |    5 +
 deltaspike/modules/beanval/pom.xml              |   41 +
 deltaspike/modules/beanval/pom.xml~             |   61 +
 deltaspike/modules/beanval/testout              | 1041 ++++++++++++++++++
 deltaspike/modules/pom.xml                      |    1 +
 deltaspike/modules/pom.xml~                     |   43 +
 18 files changed, 1840 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/api/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/api/pom.xml b/deltaspike/modules/beanval/api/pom.xml
new file mode 100644
index 0000000..dc14fc2
--- /dev/null
+++ b/deltaspike/modules/beanval/api/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.apache.deltaspike.modules</groupId>
+		<artifactId>beanval-module-project</artifactId>
+		<version>0.5-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>deltaspike-beanval-module-api</artifactId>
+
+	<name>Apache DeltaSpike BeanValidation-Module API</name>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.deltaspike.core</groupId>
+			<artifactId>deltaspike-core-api</artifactId>
+		</dependency>
+	</dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/api/pom.xml~
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/api/pom.xml~ b/deltaspike/modules/beanval/api/pom.xml~
new file mode 100644
index 0000000..8492a25
--- /dev/null
+++ b/deltaspike/modules/beanval/api/pom.xml~
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.deltaspike.modules</groupId>
+        <artifactId>jsf-module-project</artifactId>
+        <version>0.5-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.deltaspike.modules</groupId>
+    <artifactId>deltaspike-jsf-module-api</artifactId>
+
+    <name>Apache DeltaSpike JSF-Module API</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.deltaspike.core</groupId>
+            <artifactId>deltaspike-core-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_2.5_spec</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+        </dependency>
+
+
+    </dependencies>
+
+
+</project>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/pom.xml b/deltaspike/modules/beanval/impl/pom.xml
new file mode 100644
index 0000000..f3cf634
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.apache.deltaspike.modules</groupId>
+		<artifactId>beanval-module-project</artifactId>
+		<version>0.5-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>deltaspike-beanval-module-impl</artifactId>
+
+	<name>Apache DeltaSpike BeanValidation-Module Impl</name>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.deltaspike.core</groupId>
+			<artifactId>deltaspike-core-api</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.deltaspike.core</groupId>
+			<artifactId>deltaspike-core-impl</artifactId>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-validation_1.0_spec</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+	</dependencies>
+
+
+</project>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/pom.xml~
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/pom.xml~ b/deltaspike/modules/beanval/impl/pom.xml~
new file mode 100644
index 0000000..e23fde0
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/pom.xml~
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.deltaspike.modules</groupId>
+        <artifactId>jsf-module-project</artifactId>
+        <version>0.5-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.deltaspike.modules</groupId>
+    <artifactId>deltaspike-jsf-module-impl</artifactId>
+
+    <name>Apache DeltaSpike JSF-Module Impl</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.deltaspike.core</groupId>
+            <artifactId>deltaspike-core-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.core</groupId>
+            <artifactId>deltaspike-core-impl</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-security-module-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-security-module-impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-jsf-module-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-el_2.2_spec</artifactId>
+            <version>1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+        </dependency>
+
+        <!-- we use Arquillian Warp to test our JSF apps -->
+        <dependency>
+            <groupId>org.jboss.arquillian.extension</groupId>
+            <artifactId>arquillian-drone-api</artifactId>
+            <version>1.1.0.CR3</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.arquillian.extension</groupId>
+            <artifactId>arquillian-warp-api</artifactId>
+            <version>1.0.0.Alpha1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.arquillian.graphene</groupId>
+            <artifactId>graphene-webdriver</artifactId>
+            <version>2.0.0.Alpha2</version>
+            <type>pom</type>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+
+</project>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java b/deltaspike/modules/beanval/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java
new file mode 100644
index 0000000..ca9c12f
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java
@@ -0,0 +1,68 @@
+/*
+ * 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.deltaspike.beanval.impl;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorFactory;
+import javax.validation.Validation;
+
+import org.apache.deltaspike.core.api.provider.BeanProvider;
+
+public class CDIAwareConstraintValidatorFactory implements
+        ConstraintValidatorFactory
+{
+
+    private final Logger log = Logger
+            .getLogger(CDIAwareConstraintValidatorFactory.class.toString());
+    
+    private final ConstraintValidatorFactory delegate;
+
+    public CDIAwareConstraintValidatorFactory()
+    {
+        delegate = Validation.byDefaultProvider().configure().getDefaultConstraintValidatorFactory();
+        if (log.isLoggable(Level.CONFIG))
+        {
+            log.config("Setting up delegate ConstraintValidatorFactory as " + 
+                    delegate.getClass().getCanonicalName());
+        }
+    }
+
+    @Override
+    public <T extends ConstraintValidator<?, ?>> T getInstance(Class<T> validatorClass)
+    {
+        T resolvedInst = null;
+        resolvedInst = BeanProvider.getContextualReference(validatorClass);
+        
+        if (resolvedInst == null)
+        {
+            if (log.isLoggable(Level.CONFIG))
+            {
+                log.config("No contextual instances found for class " + validatorClass.getCanonicalName() +
+                         " delegating to DefaultProvider behavior.");
+            }
+            resolvedInst = this.delegate.getInstance(validatorClass);
+        }
+        
+        return resolvedInst;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java
new file mode 100644
index 0000000..90dacd6
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java
@@ -0,0 +1,32 @@
+/*
+ * 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.deltaspike.beanval.test;
+
+import org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+public class ArchiveUtils {
+    public static JavaArchive[] getDeltaSpikeCore() {
+        JavaArchive[] coreArchives = ShrinkWrapArchiveUtil.getArchives(null,
+                "META-INF/beans.xml",
+                new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.test.category"},
+                null);
+        return coreArchives;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java
new file mode 100644
index 0000000..0f6c550
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java
@@ -0,0 +1,29 @@
+/*
+ * 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.deltaspike.beanval.test;
+
+public class ArrayChecker {
+    public boolean checkArray(ArraySize as, String[] data) {
+        if (data.length < as.min() || data.length > as.max()) {
+             return false;
+        } else {
+             return true;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java
new file mode 100644
index 0000000..afa4cd8
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java
@@ -0,0 +1,46 @@
+/*
+ * 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.deltaspike.beanval.test;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Constraint(validatedBy = InjectableConstraintValidator.class)
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface ArraySize {
+    int min() default 0;
+    int max() default Integer.MAX_VALUE;
+    String message() default "{org.apache.deltaspike.modules.beanval.constraints.arraySize}";
+
+    Class<?>[] groups() default {};
+
+    Class<? extends Payload>[] payload() default {};
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java
new file mode 100644
index 0000000..1b8c50a
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java
@@ -0,0 +1,36 @@
+/*
+ * 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.deltaspike.beanval.test;
+
+public class BasicPojo
+{
+    @ArraySize(min=1)
+    private String[] value;
+
+    public String[] getValue()
+    {
+        return value;
+    }
+
+    public void setValue(String[] value)
+    {
+        this.value = value;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java
new file mode 100644
index 0000000..b8475c4
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java
@@ -0,0 +1,45 @@
+/*
+ * 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.deltaspike.beanval.test;
+
+import javax.inject.Inject;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class InjectableConstraintValidator implements
+        ConstraintValidator<ArraySize, String[]>
+{
+    @Inject
+    private ArrayChecker arrayChecker;
+
+    private ArraySize arraySize;
+
+    @Override
+    public void initialize(ArraySize arraySize)
+    {
+        this.arraySize = arraySize;
+    }
+
+    @Override
+    public boolean isValid(String[] values, ConstraintValidatorContext context)
+    {
+       return arrayChecker.checkArray(arraySize, values);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
new file mode 100644
index 0000000..40c9a98
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
@@ -0,0 +1,78 @@
+/*
+ * 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.deltaspike.beanval.test;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
+
+import org.apache.deltaspike.beanval.impl.CDIAwareConstraintValidatorFactory;
+import org.apache.deltaspike.test.category.WebProfileCategory;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+@Category(WebProfileCategory.class)
+public class InjectedValidationTest
+{
+    @Deployment
+    public static WebArchive createArchive()
+    {
+        return ShrinkWrap.create(WebArchive.class,"beanval.war")
+                .addClasses(BasicPojo.class,InjectableConstraintValidator.class,
+                        CDIAwareConstraintValidatorFactory.class,ArraySize.class,
+                        ArrayChecker.class)
+                .addAsWebInfResource("validation.xml", "classes/META-INF/validation.xml")
+                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCore());
+    }
+    
+    private Validator validator;
+    
+    @Before
+    public void initValidator()
+    {
+        this.validator = Validation.buildDefaultValidatorFactory().getValidator();
+    }
+    
+    @Test
+    public void testValidate()
+    {
+        String[] entries = new String[]{"abc","def","ghi"};
+        BasicPojo p = new BasicPojo();
+        p.setValue(entries);
+        final Set<ConstraintViolation<BasicPojo>> violations = validator.validate(p);
+        StringBuilder sb = new StringBuilder();
+        for(ConstraintViolation<BasicPojo> violation : violations) {
+            sb.append(violation.getMessage() + " "+ violation.getPropertyPath());
+        }
+        Assert.assertTrue(sb.toString(),violations.isEmpty());
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/src/test/resources/arquillian.xml b/deltaspike/modules/beanval/impl/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..973dbb4
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/src/test/resources/arquillian.xml
@@ -0,0 +1,84 @@
+<!--
+    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.
+-->
+
+<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+    <!--Uncomment to have test archives exported to the file system for inspection -->
+    <!--
+    <engine>
+        <property name="deploymentExportPath">target/</property>
+    </engine>
+    -->
+
+    <container qualifier="jbossas-managed-7">
+        <configuration>
+            <property name="javaVmArguments">-client -noverify -Xms64m -Xmx1024m -XX:MaxPermSize=512m</property>
+            <property name="outputToConsole">false</property>
+            <property name="allowConnectingToRunningServer">true</property>
+        </configuration>
+    </container>
+
+    <container qualifier="jbossas-build-managed-7">
+        <configuration>
+            <property name="jbossHome">${arquillian.jboss_home}</property>
+            <property name="javaVmArguments">-client -noverify -Xms64m -Xmx1024m -XX:MaxPermSize=512m</property>
+            <property name="outputToConsole">false</property>
+            <property name="allowConnectingToRunningServer">true</property>
+        </configuration>
+    </container>
+
+    <container qualifier="jbossas-remote-7">
+        <!--
+        for remote debugging enable "remote socket debugging" - uncomment:
+            set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
+        in
+            standalone.conf (standalone.conf.bat)
+        and connect to
+            port 8787
+        -->
+    </container>
+
+    <!-- don't remove the qualifier - it's needed for the arquillian.launch property -->
+    <container qualifier="glassfish-remote-3.1">
+    </container>
+
+    <container qualifier="wls-remote-12c">
+        <configuration>
+            <property name="adminUrl">t3://localhost:7001</property>
+            <property name="adminUserName">weblogic1</property>
+            <property name="adminPassword">weblogic1</property>
+            <property name="target">AdminServer</property>
+            <property name="wlsHome">${WLS_HOME}</property>
+        </configuration>
+    </container>
+
+    <container qualifier="tomee">
+        <configuration>
+            <!-- tomee gets copied to this directory during the build -->
+            <property name="dir">target/tomee</property>
+
+            <!-- value '-1' to allow arquillian-tomee-remote to use dynamic settings -->
+            <property name="httpPort">-1</property>
+            <property name="ajpPort">-1</property>
+            <property name="stopPort">-1</property>
+            <property name="appWorkingDir">target/arquillian-test-working-dir</property>
+        </configuration>
+    </container>
+</arquillian>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/impl/src/test/resources/validation.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/src/test/resources/validation.xml b/deltaspike/modules/beanval/impl/src/test/resources/validation.xml
new file mode 100644
index 0000000..189e730
--- /dev/null
+++ b/deltaspike/modules/beanval/impl/src/test/resources/validation.xml
@@ -0,0 +1,5 @@
+<validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration">
+    <constraint-validator-factory>org.apache.deltaspike.beanval.impl.CDIAwareConstraintValidatorFactory</constraint-validator-factory>
+</validation-config>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/pom.xml b/deltaspike/modules/beanval/pom.xml
new file mode 100644
index 0000000..3e2dce4
--- /dev/null
+++ b/deltaspike/modules/beanval/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.deltaspike.modules</groupId>
+        <artifactId>modules-project</artifactId>
+        <version>0.5-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.deltaspike.modules</groupId>
+    <artifactId>beanval-module-project</artifactId>
+    <version>0.5-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <name>Apache DeltaSpike BeanValidation-Module</name>
+
+
+    <modules>
+        <module>api</module>
+        <module>impl</module>
+    </modules>
+</project>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2ed57df7/deltaspike/modules/beanval/pom.xml~
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/pom.xml~ b/deltaspike/modules/beanval/pom.xml~
new file mode 100644
index 0000000..a427bc1
--- /dev/null
+++ b/deltaspike/modules/beanval/pom.xml~
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.deltaspike.modules</groupId>
+        <artifactId>modules-project</artifactId>
+        <version>0.5-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.deltaspike.modules</groupId>
+    <artifactId>beanval-module-project</artifactId>
+    <version>0.5-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <name>Apache DeltaSpike BeanValidation-Module</name>
+
+
+    <modules>
+        <module>api</module>
+        <module>impl</module>
+    </modules>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.myfaces.core</groupId>
+                <artifactId>myfaces-api</artifactId>
+                <version>${myfaces2.version}</version>
+                <scope>provided</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <!-- JSF API, just for compiling -->
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>