diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..f75a1f8
--- /dev/null
+++ b/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..b3295c5
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index e86c853..e12baa7 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -29,13 +29,9 @@
-
-
-
-
-
-
+
+
+
-
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 55a314f..a01d4cc 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,7 +1,6 @@
-
@@ -16,58 +15,7 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
- 1.7
-
-
-
-
-
-
-
-
-
-
-
- 1.7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 9b3460f..0a76262 100644
--- a/README.md
+++ b/README.md
@@ -126,15 +126,15 @@ The [BuiltInConstraint.java](https://github.com/netceteragroup/valdr-bean-valida
| Bean Validation | valdr | Comment |
|-----------------|-------|---------|
-| [NotNull](http://docs.oracle.com/javaee/7/api/javax/validation/constraints/NotNull.html) | [required](https://github.com/netceteragroup/valdr#required) | |
-| [Min](http://docs.oracle.com/javaee/7/api/javax/validation/constraints/Min.html) | [min](https://github.com/netceteragroup/valdr#min--max) | |
-| [Max](http://docs.oracle.com/javaee/7/api/javax/validation/constraints/Max.html) | [max](https://github.com/netceteragroup/valdr#min--max) | |
-| [Size](http://docs.oracle.com/javaee/7/api/javax/validation/constraints/Size.html) | [size](https://github.com/netceteragroup/valdr#size) | |
-| [Digits](http://docs.oracle.com/javaee/7/api/javax/validation/constraints/Digits.html) | [digits](https://github.com/netceteragroup/valdr#digits) | |
-| [Pattern](http://docs.oracle.com/javaee/7/api/javax/validation/constraints/Pattern.html) | [pattern](https://github.com/netceteragroup/valdr#partern) | Java regex pattern is transformed to JavaScript pattern |
-| [Future](http://docs.oracle.com/javaee/7/api/javax/validation/constraints/Future.html) | [future](https://github.com/netceteragroup/valdr#future--past) | |
-| [Past](http://docs.oracle.com/javaee/7/api/javax/validation/constraints/Past.html) | [past](https://github.com/netceteragroup/valdr#future--past) | |
-| [Email](https://docs.jboss.org/hibernate/validator/5.1/api/org/hibernate/validator/constraints/Email.html) |[email](https://github.com/netceteragroup/valdr#email) | proprietary Hibernate Validator (not in Bean Validation spec) |
+| [NotNull](https://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/constraints/NotNull.html) | [required](https://github.com/netceteragroup/valdr#required) | |
+| [Min](https://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/constraints/Min.html) | [min](https://github.com/netceteragroup/valdr#min--max) | |
+| [Max](https://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/constraints/Max.html) | [max](https://github.com/netceteragroup/valdr#min--max) | |
+| [Size](https://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/constraints/Size.html) | [size](https://github.com/netceteragroup/valdr#size) | |
+| [Digits](https://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/constraints/Digits.html) | [digits](https://github.com/netceteragroup/valdr#digits) | |
+| [Pattern](https://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/constraints/Pattern.html) | [pattern](https://github.com/netceteragroup/valdr#partern) | Java regex pattern is transformed to JavaScript pattern |
+| [Future](https://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/constraints/Future.html) | [future](https://github.com/netceteragroup/valdr#future--past) | |
+| [Past](https://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/constraints/Past.html) | [past](https://github.com/netceteragroup/valdr#future--past) | |
+| [Email](https://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/constraints/Email.html) |[email](https://github.com/netceteragroup/valdr#email) | |
| [URL](https://docs.jboss.org/hibernate/validator/5.1/api/org/hibernate/validator/constraints/URL.html) |[url](https://github.com/netceteragroup/valdr#url) | proprietary Hibernate Validator (not in Bean Validation spec) |
## Support
diff --git a/pom.xml b/pom.xml
index e4b9454..a9e6e72 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
2014
- 3.0.3
+ 3.5.2
@@ -79,35 +79,35 @@
UTF-8
UTF-8
- 1.7
- 1.7
+ 1.8
+ 1.8
- 3.1
- 1.5
- 2.9.1
- 2.6
- 2.5
- 2.2.1
- 1.6.5
+ 3.7.0
+ 1.6
+ 3.0.0
+ 3.1.0
+ 2.5.3
+ 3.0.1
+ 1.6.7
- 1.1.0.Final
- 3.3.2
- 1.2
- 2.4
- 17.0
+ 2.0.1.Final
+ 3.7
+ 1.4
+ 2.6
+ 23.0
1.3
- 1.0.0.Final
- 5.1.1.Final
- 2.4.0
- 4.11
- 1.14.0
- 1.9.5
+ 1.0.2
+ 6.0.9.Final
+ 2.9.5
+ 4.12
+ 1.16.20
+ 2.18.3
0.9.9
- 3.0.1
- 1.7.7
- 4.0.5.RELEASE
+ 4.0.0
+ 1.7.9
+ 5.0.5.RELEASE
@@ -133,7 +133,7 @@
${bean-validation.version}
- org.hibernate
+ org.hibernate.validator
hibernate-validator
${hibernate-validator.version}
@@ -190,6 +190,12 @@
${spring.version}
test
+
+ org.springframework
+ spring-web
+ ${spring.version}
+ test
+
org.hamcrest
hamcrest-library
diff --git a/valdr-bean-validation-demo/pom.xml b/valdr-bean-validation-demo/pom.xml
index 9b96162..190193a 100644
--- a/valdr-bean-validation-demo/pom.xml
+++ b/valdr-bean-validation-demo/pom.xml
@@ -21,7 +21,7 @@
${project.version}
- org.hibernate
+ org.hibernate.validator
hibernate-validator
diff --git a/valdr-bean-validation-demo/valdr-bean-validation-demo.iml b/valdr-bean-validation-demo/valdr-bean-validation-demo.iml
index eb17b9b..e16ca87 100644
--- a/valdr-bean-validation-demo/valdr-bean-validation-demo.iml
+++ b/valdr-bean-validation-demo/valdr-bean-validation-demo.iml
@@ -12,7 +12,7 @@
-
+
@@ -23,21 +23,25 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/valdr-bean-validation-parent.iml b/valdr-bean-validation-parent.iml
index b26c4d0..9e16274 100644
--- a/valdr-bean-validation-parent.iml
+++ b/valdr-bean-validation-parent.iml
@@ -1,6 +1,6 @@
-
+
diff --git a/valdr-bean-validation/pom.xml b/valdr-bean-validation/pom.xml
index 3315c9d..57f3601 100644
--- a/valdr-bean-validation/pom.xml
+++ b/valdr-bean-validation/pom.xml
@@ -44,7 +44,7 @@
commons-io
- org.hibernate
+ org.hibernate.validator
hibernate-validator
@@ -71,6 +71,11 @@
spring-test
test
+
+ org.springframework
+ spring-web
+ test
+
org.slf4j
slf4j-simple
@@ -108,7 +113,7 @@
org.jacoco
jacoco-maven-plugin
- 0.7.0.201403182114
+ 0.8.1
com/github/valdr/thirdparty/**/*.class
diff --git a/valdr-bean-validation/src/main/java/com/github/valdr/BuiltInConstraint.java b/valdr-bean-validation/src/main/java/com/github/valdr/BuiltInConstraint.java
index 62f89a4..1635ac9 100644
--- a/valdr-bean-validation/src/main/java/com/github/valdr/BuiltInConstraint.java
+++ b/valdr-bean-validation/src/main/java/com/github/valdr/BuiltInConstraint.java
@@ -3,13 +3,13 @@
import com.github.valdr.decorator.AbstractConstraintAttributesDecorator;
import com.github.valdr.decorator.NullDecorator;
import com.github.valdr.decorator.PatternDecorator;
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import lombok.Getter;
-import lombok.SneakyThrows;
-import org.hibernate.validator.constraints.Email;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.stream.Collectors;
import javax.validation.constraints.Digits;
+import javax.validation.constraints.Email;
import javax.validation.constraints.Future;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
@@ -17,8 +17,9 @@
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
+
+import lombok.Getter;
+import lombok.SneakyThrows;
/**
* All constraints currently supported out-of-the-box by valdr Bean Validation. Each value represents a constraint
@@ -28,10 +29,16 @@
public enum BuiltInConstraint {
// CHECKSTYLE:OFF
- REQUIRED("required", NotNull.class), MIN("min", Min.class), MAX("max", Max.class), SIZE("size", Size.class),
- DIGITS("digits", Digits.class), PATTERN("pattern", Pattern.class, PatternDecorator.class), FUTURE("future",
- Future.class), PAST("past", Past.class), EMAIL("hibernateEmail", Email.class), URL("hibernateUrl",
- org.hibernate.validator.constraints.URL.class);
+ REQUIRED("required", NotNull.class),
+ MIN("min", Min.class),
+ MAX("max", Max.class),
+ SIZE("size", Size.class),
+ DIGITS("digits", Digits.class),
+ PATTERN("pattern", Pattern.class, PatternDecorator.class),
+ FUTURE("future", Future.class),
+ PAST("past", Past.class),
+ EMAIL("email", Email.class),
+ URL("hibernateUrl", org.hibernate.validator.constraints.URL.class);
// CHECKSTYLE:ON
@Getter
@@ -39,12 +46,12 @@ public enum BuiltInConstraint {
private final Class extends AbstractConstraintAttributesDecorator> decorator;
private final String camelCaseName;
- private BuiltInConstraint(String camelCaseName, Class extends Annotation> beanValidationAnnotation) {
+ BuiltInConstraint(String camelCaseName, Class extends Annotation> beanValidationAnnotation) {
this(camelCaseName, beanValidationAnnotation, NullDecorator.class);
}
- private BuiltInConstraint(String camelCaseName, Class extends Annotation> beanValidationAnnotation,
- Class extends AbstractConstraintAttributesDecorator> decorator) {
+ BuiltInConstraint(String camelCaseName, Class extends Annotation> beanValidationAnnotation,
+ Class extends AbstractConstraintAttributesDecorator> decorator) {
this.camelCaseName = camelCaseName;
this.decorator = decorator;
this.beanValidationAnnotation = beanValidationAnnotation;
@@ -72,16 +79,12 @@ public AbstractConstraintAttributesDecorator createDecoratorFor(ConstraintAttrib
* @return all collected annotation classes
*/
public static Iterable> getAllBeanValidationAnnotations() {
- return Iterables.transform(Arrays.asList(values()), new Function>() {
-
- @Override
- public Class extends Annotation> apply(BuiltInConstraint input) {
- if (input == null) {
- throw new NullPointerException("Passed validator must not be null.");
- }
- return input.getBeanValidationAnnotation();
+ return Arrays.stream(values()).map(input -> {
+ if (input == null) {
+ throw new NullPointerException("Passed validator must not be null.");
}
- });
+ return input.getBeanValidationAnnotation();
+ }).collect(Collectors.toList());
}
/**
diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java b/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java
index bac950d..6b92466 100644
--- a/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java
+++ b/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java
@@ -9,7 +9,7 @@
import com.github.valdr.model.d.SubClassWithNoValidatedMembers;
import com.github.valdr.model.d.SuperClassWithValidatedMember;
import com.github.valdr.model.e.TestModelClassWithLotsOfIrrelevantAnnotations;
-import com.github.valdr.model.f.TestModelWithHibernateEmailAnnotation;
+import com.github.valdr.model.f.TestModelWithEmailAnnotation;
import com.github.valdr.model.g.TestModelWithHibernateUrlAnnotation;
import com.github.valdr.model.h.TestModelWithPatterns;
import com.github.valdr.model.validation.CustomValidation;
@@ -155,16 +155,16 @@ public void shouldProcessConfiguredCustomAnnotation() {
* See method name.
*/
@Test
- public void shouldSupportHibernateEmailAnnotation() {
+ public void shouldSupportEmailAnnotation() {
// given
- parserConfiguredFor(Lists.newArrayList(TestModelWithHibernateEmailAnnotation.class.getPackage().getName()),
+ parserConfiguredFor(Lists.newArrayList(TestModelWithEmailAnnotation.class.getPackage().getName()),
emptyStringList());
// when
String json = parser.parse();
// then
- assertThat(json, containsString(TestModelWithHibernateEmailAnnotation.class.getSimpleName()));
- assertThat(json, containsString("hibernateEmail"));
- assertThat(json, containsString("{org.hibernate.validator.constraints.Email.message}"));
+ assertThat(json, containsString(TestModelWithEmailAnnotation.class.getSimpleName()));
+ assertThat(json, containsString("email"));
+ assertThat(json, containsString("{javax.validation.constraints.Email.message}"));
}
/**
diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/ValdrBeanValidationTest.java b/valdr-bean-validation/src/test/java/com/github/valdr/ValdrBeanValidationTest.java
index efa2457..bd0f7d9 100644
--- a/valdr-bean-validation/src/test/java/com/github/valdr/ValdrBeanValidationTest.java
+++ b/valdr-bean-validation/src/test/java/com/github/valdr/ValdrBeanValidationTest.java
@@ -2,14 +2,16 @@
import com.github.valdr.cli.ValdrBeanValidation;
import com.github.valdr.util.SysOutSlurper;
-import lombok.SneakyThrows;
+
import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
import org.junit.Test;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.nio.charset.Charset;
+
+import lombok.SneakyThrows;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
@@ -73,8 +75,7 @@ public void shouldComplainAboutInvalidConfigurations() {
ValdrBeanValidation.main(args);
} catch (Exception e) {
// expect
- assertThat(e.getClass().getName().toString(), is(Options.InvalidConfigurationException.class.getName().toString
- ()));
+ assertThat(e.getClass().getName(), is(Options.InvalidConfigurationException.class.getName()));
}
}
@@ -112,14 +113,14 @@ public void shouldPrintToPrintToOutputFileIfConfigured() throws IOException {
ValdrBeanValidation.main(args);
// then
- assertThat(FileUtils.readFileToString(outputTempFile), is("{ }"));
+ assertThat(FileUtils.readFileToString(outputTempFile, Charset.defaultCharset()), is("{ }"));
}
private String createTempFile(String string) throws IOException {
File tempFile = File.createTempFile("valdr", "json");
FileWriter writer = new FileWriter(tempFile);
- IOUtils.write(string, writer);
- IOUtils.closeQuietly(writer);
+ writer.write(string);
+ writer.close();
return tempFile.getAbsolutePath();
}
diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/ValidationRulesServletTest.java b/valdr-bean-validation/src/test/java/com/github/valdr/ValidationRulesServletTest.java
index 0e902ca..66be7d0 100644
--- a/valdr-bean-validation/src/test/java/com/github/valdr/ValidationRulesServletTest.java
+++ b/valdr-bean-validation/src/test/java/com/github/valdr/ValidationRulesServletTest.java
@@ -1,25 +1,24 @@
package com.github.valdr;
-import org.apache.commons.io.IOUtils;
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.test.util.ReflectionTestUtils;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.mock;
-import static org.mockito.Matchers.contains;
/**
* Tests ValidationRulesServlet.
@@ -120,8 +119,8 @@ private void givenThisConfiguration(String jsonString) throws IOException {
private String createTempFile(String string) throws IOException {
File tempFile = File.createTempFile("valdr", "json");
FileWriter writer = new FileWriter(tempFile);
- IOUtils.write(string, writer);
- IOUtils.closeQuietly(writer);
+ writer.write(string);
+ writer.close();
return tempFile.getAbsolutePath();
}
}
diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/model/f/TestModelWithEmailAnnotation.java b/valdr-bean-validation/src/test/java/com/github/valdr/model/f/TestModelWithEmailAnnotation.java
new file mode 100644
index 0000000..d8b363f
--- /dev/null
+++ b/valdr-bean-validation/src/test/java/com/github/valdr/model/f/TestModelWithEmailAnnotation.java
@@ -0,0 +1,8 @@
+package com.github.valdr.model.f;
+
+import javax.validation.constraints.Email;
+
+public class TestModelWithEmailAnnotation {
+ @Email
+ private String email;
+}
diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/model/f/TestModelWithHibernateEmailAnnotation.java b/valdr-bean-validation/src/test/java/com/github/valdr/model/f/TestModelWithHibernateEmailAnnotation.java
deleted file mode 100644
index fc63b72..0000000
--- a/valdr-bean-validation/src/test/java/com/github/valdr/model/f/TestModelWithHibernateEmailAnnotation.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.github.valdr.model.f;
-
-import org.hibernate.validator.constraints.Email;
-
-public class TestModelWithHibernateEmailAnnotation {
- @Email
- private String email;
-}
diff --git a/valdr-bean-validation/valdr-bean-validation.iml b/valdr-bean-validation/valdr-bean-validation.iml
index 0a0ba32..e07368d 100644
--- a/valdr-bean-validation/valdr-bean-validation.iml
+++ b/valdr-bean-validation/valdr-bean-validation.iml
@@ -1,6 +1,6 @@
-
+
@@ -12,32 +12,40 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
\ No newline at end of file