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/24 03:36:09 UTC
[1/3] git commit: DELTASPIKE-387 Created new name for the module.
Updated Branches:
refs/heads/master ec592a451 -> 2f322a0e8
DELTASPIKE-387 Created new name for the module.
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/8ec331bf
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/8ec331bf
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/8ec331bf
Branch: refs/heads/master
Commit: 8ec331bff1ca4097e71c2cd4b92adcbbea924b70
Parents: ec592a4
Author: John D. Ament <jo...@gmail.com>
Authored: Sun Jun 23 21:25:17 2013 -0400
Committer: John D. Ament <jo...@gmail.com>
Committed: Sun Jun 23 21:25:17 2013 -0400
----------------------------------------------------------------------
deltaspike/modules/bean-validation/api/pom.xml | 33 ++++++++
deltaspike/modules/bean-validation/impl/pom.xml | 47 +++++++++++
.../CDIAwareConstraintValidatorFactory.java | 70 ++++++++++++++++
.../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 | 23 ++++++
deltaspike/modules/bean-validation/pom.xml | 41 ++++++++++
deltaspike/modules/beanval/api/pom.xml | 33 --------
deltaspike/modules/beanval/impl/pom.xml | 47 -----------
.../CDIAwareConstraintValidatorFactory.java | 70 ----------------
.../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 | 23 ------
deltaspike/modules/beanval/pom.xml | 41 ----------
deltaspike/modules/pom.xml | 2 +-
25 files changed, 565 insertions(+), 565 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8ec331bf/deltaspike/modules/bean-validation/api/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/api/pom.xml b/deltaspike/modules/bean-validation/api/pom.xml
new file mode 100644
index 0000000..688a921
--- /dev/null
+++ b/deltaspike/modules/bean-validation/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>bean-validation-module-project</artifactId>
+ <version>0.5-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>deltaspike-bean-validation-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/8ec331bf/deltaspike/modules/bean-validation/impl/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/pom.xml b/deltaspike/modules/bean-validation/impl/pom.xml
new file mode 100644
index 0000000..bfd6795
--- /dev/null
+++ b/deltaspike/modules/bean-validation/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>bean-validation-module-project</artifactId>
+ <version>0.5-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>deltaspike-bean-validation-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/8ec331bf/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java b/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java
new file mode 100644
index 0000000..53b33b4
--- /dev/null
+++ b/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java
@@ -0,0 +1,70 @@
+/*
+ * 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;
+
+/**
+ * A factory for creating CDI Aware/Enabled ConstraintValidators.
+ *
+ */
+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,true);
+ 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/8ec331bf/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java
new file mode 100644
index 0000000..90dacd6
--- /dev/null
+++ b/deltaspike/modules/bean-validation/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/8ec331bf/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java
new file mode 100644
index 0000000..0f6c550
--- /dev/null
+++ b/deltaspike/modules/bean-validation/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/8ec331bf/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java
new file mode 100644
index 0000000..afa4cd8
--- /dev/null
+++ b/deltaspike/modules/bean-validation/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/8ec331bf/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java
new file mode 100644
index 0000000..1b8c50a
--- /dev/null
+++ b/deltaspike/modules/bean-validation/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/8ec331bf/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java
new file mode 100644
index 0000000..b8475c4
--- /dev/null
+++ b/deltaspike/modules/bean-validation/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/8ec331bf/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
new file mode 100644
index 0000000..40c9a98
--- /dev/null
+++ b/deltaspike/modules/bean-validation/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/8ec331bf/deltaspike/modules/bean-validation/impl/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/resources/arquillian.xml b/deltaspike/modules/bean-validation/impl/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..973dbb4
--- /dev/null
+++ b/deltaspike/modules/bean-validation/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/8ec331bf/deltaspike/modules/bean-validation/impl/src/test/resources/validation.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/resources/validation.xml b/deltaspike/modules/bean-validation/impl/src/test/resources/validation.xml
new file mode 100644
index 0000000..bdaa07b
--- /dev/null
+++ b/deltaspike/modules/bean-validation/impl/src/test/resources/validation.xml
@@ -0,0 +1,23 @@
+<!--
+ 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.
+-->
+<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/8ec331bf/deltaspike/modules/bean-validation/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/pom.xml b/deltaspike/modules/bean-validation/pom.xml
new file mode 100644
index 0000000..541b261
--- /dev/null
+++ b/deltaspike/modules/bean-validation/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>bean-validation-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/8ec331bf/deltaspike/modules/beanval/api/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/api/pom.xml b/deltaspike/modules/beanval/api/pom.xml
deleted file mode 100644
index dc14fc2..0000000
--- a/deltaspike/modules/beanval/api/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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/8ec331bf/deltaspike/modules/beanval/impl/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/impl/pom.xml b/deltaspike/modules/beanval/impl/pom.xml
deleted file mode 100644
index f3cf634..0000000
--- a/deltaspike/modules/beanval/impl/pom.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?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/8ec331bf/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
deleted file mode 100644
index 53b33b4..0000000
--- a/deltaspike/modules/beanval/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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;
-
-/**
- * A factory for creating CDI Aware/Enabled ConstraintValidators.
- *
- */
-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,true);
- 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/8ec331bf/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
deleted file mode 100644
index 90dacd6..0000000
--- a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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/8ec331bf/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
deleted file mode 100644
index 0f6c550..0000000
--- a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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/8ec331bf/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
deleted file mode 100644
index afa4cd8..0000000
--- a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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/8ec331bf/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
deleted file mode 100644
index 1b8c50a..0000000
--- a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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/8ec331bf/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
deleted file mode 100644
index b8475c4..0000000
--- a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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/8ec331bf/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
deleted file mode 100644
index 40c9a98..0000000
--- a/deltaspike/modules/beanval/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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/8ec331bf/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
deleted file mode 100644
index 973dbb4..0000000
--- a/deltaspike/modules/beanval/impl/src/test/resources/arquillian.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<!--
- 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/8ec331bf/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
deleted file mode 100644
index bdaa07b..0000000
--- a/deltaspike/modules/beanval/impl/src/test/resources/validation.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
- 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.
--->
-<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/8ec331bf/deltaspike/modules/beanval/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/beanval/pom.xml b/deltaspike/modules/beanval/pom.xml
deleted file mode 100644
index 3e2dce4..0000000
--- a/deltaspike/modules/beanval/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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/8ec331bf/deltaspike/modules/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/pom.xml b/deltaspike/modules/pom.xml
index ad3f446..17b7b23 100644
--- a/deltaspike/modules/pom.xml
+++ b/deltaspike/modules/pom.xml
@@ -40,6 +40,6 @@
<module>servlet</module>
<module>jsf</module>
<module>partial-bean</module>
- <module>beanval</module>
+ <module>bean-validation</module>
</modules>
</project>
[3/3] git commit: DELTASPIKE-387 Changed test package name.
Posted by jo...@apache.org.
DELTASPIKE-387 Changed test package name.
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/2f322a0e
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/2f322a0e
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/2f322a0e
Branch: refs/heads/master
Commit: 2f322a0e8cc2324b9485e9a779a38709217f36ba
Parents: c4d5975
Author: John D. Ament <jo...@gmail.com>
Authored: Sun Jun 23 21:35:20 2013 -0400
Committer: John D. Ament <jo...@gmail.com>
Committed: Sun Jun 23 21:35:20 2013 -0400
----------------------------------------------------------------------
.../beanValidation/test/ArchiveUtils.java | 32 ++++++++
.../beanValidation/test/ArrayChecker.java | 29 ++++++++
.../beanValidation/test/ArraySize.java | 46 ++++++++++++
.../beanValidation/test/BasicPojo.java | 36 +++++++++
.../test/InjectableConstraintValidator.java | 45 +++++++++++
.../test/InjectedValidationTest.java | 78 ++++++++++++++++++++
.../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 --------------------
12 files changed, 266 insertions(+), 266 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArchiveUtils.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArchiveUtils.java
new file mode 100644
index 0000000..24278ba
--- /dev/null
+++ b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/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.beanValidation.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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArrayChecker.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArrayChecker.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArrayChecker.java
new file mode 100644
index 0000000..35542df
--- /dev/null
+++ b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/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.beanValidation.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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArraySize.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArraySize.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArraySize.java
new file mode 100644
index 0000000..4f85aa3
--- /dev/null
+++ b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/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.beanValidation.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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/BasicPojo.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/BasicPojo.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/BasicPojo.java
new file mode 100644
index 0000000..8064598
--- /dev/null
+++ b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/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.beanValidation.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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/InjectableConstraintValidator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/InjectableConstraintValidator.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/InjectableConstraintValidator.java
new file mode 100644
index 0000000..731c1f7
--- /dev/null
+++ b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/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.beanValidation.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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/InjectedValidationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/InjectedValidationTest.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/InjectedValidationTest.java
new file mode 100644
index 0000000..d2f9196
--- /dev/null
+++ b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/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.beanValidation.test;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
+
+import org.apache.deltaspike.beanValidation.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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java
deleted file mode 100644
index 90dacd6..0000000
--- a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArchiveUtils.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java
deleted file mode 100644
index 0f6c550..0000000
--- a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArrayChecker.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java
deleted file mode 100644
index afa4cd8..0000000
--- a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/ArraySize.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java
deleted file mode 100644
index 1b8c50a..0000000
--- a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/BasicPojo.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java
deleted file mode 100644
index b8475c4..0000000
--- a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectableConstraintValidator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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/2f322a0e/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
deleted file mode 100644
index e08fcae..0000000
--- a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.beanValidation.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());
-
- }
-}
[2/3] git commit: DELTASPIKE-387 Renamed package.
Posted by jo...@apache.org.
DELTASPIKE-387 Renamed package.
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/c4d5975f
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/c4d5975f
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/c4d5975f
Branch: refs/heads/master
Commit: c4d5975f84bfb6ba7542ed93d2412c7b2b4bbd6f
Parents: 8ec331b
Author: John D. Ament <jo...@gmail.com>
Authored: Sun Jun 23 21:32:50 2013 -0400
Committer: John D. Ament <jo...@gmail.com>
Committed: Sun Jun 23 21:32:50 2013 -0400
----------------------------------------------------------------------
.../CDIAwareConstraintValidatorFactory.java | 70 ++++++++++++++++++++
.../CDIAwareConstraintValidatorFactory.java | 70 --------------------
.../beanval/test/InjectedValidationTest.java | 2 +-
.../impl/src/test/resources/validation.xml | 2 +-
4 files changed, 72 insertions(+), 72 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c4d5975f/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanValidation/impl/CDIAwareConstraintValidatorFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanValidation/impl/CDIAwareConstraintValidatorFactory.java b/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanValidation/impl/CDIAwareConstraintValidatorFactory.java
new file mode 100644
index 0000000..434a19a
--- /dev/null
+++ b/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanValidation/impl/CDIAwareConstraintValidatorFactory.java
@@ -0,0 +1,70 @@
+/*
+ * 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.beanValidation.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;
+
+/**
+ * A factory for creating CDI Aware/Enabled ConstraintValidators.
+ *
+ */
+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,true);
+ 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/c4d5975f/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java b/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java
deleted file mode 100644
index 53b33b4..0000000
--- a/deltaspike/modules/bean-validation/impl/src/main/java/org/apache/deltaspike/beanval/impl/CDIAwareConstraintValidatorFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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;
-
-/**
- * A factory for creating CDI Aware/Enabled ConstraintValidators.
- *
- */
-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,true);
- 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/c4d5975f/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
index 40c9a98..e08fcae 100644
--- a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
+++ b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanval/test/InjectedValidationTest.java
@@ -24,7 +24,7 @@ import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
-import org.apache.deltaspike.beanval.impl.CDIAwareConstraintValidatorFactory;
+import org.apache.deltaspike.beanValidation.impl.CDIAwareConstraintValidatorFactory;
import org.apache.deltaspike.test.category.WebProfileCategory;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c4d5975f/deltaspike/modules/bean-validation/impl/src/test/resources/validation.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/resources/validation.xml b/deltaspike/modules/bean-validation/impl/src/test/resources/validation.xml
index bdaa07b..740e9bd 100644
--- a/deltaspike/modules/bean-validation/impl/src/test/resources/validation.xml
+++ b/deltaspike/modules/bean-validation/impl/src/test/resources/validation.xml
@@ -19,5 +19,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>
+ <constraint-validator-factory>org.apache.deltaspike.beanValidation.impl.CDIAwareConstraintValidatorFactory</constraint-validator-factory>
</validation-config>
\ No newline at end of file