Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hibernate 6.0 support #24

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
sudo: false
language: java
jdk:
- openjdk7
- oraclejdk8
env:
global:
secure: "KncKGamS99AWFQNs2L4a3s65BdNvP07yD/fulNZA+tsBNVLgxsieXkRdzrA5Efxbd5PvnBJuLkYgjPFSFh4uPNwijH5PnZMsSYlnSFIbLyGAIkWx2cJeUoDXOOrbHIeRmCDS6gZjs9sUZHrVlhF9B/19txf4XUjpd/6slqdsEng=" # BINTRAY_API_KEY
matrix:
- HV_VERSION=4.3.2.Final
- HV_VERSION=5.0.3.Final DEPLOY=yes
- HV_VERSION=5.1.3.Final
- HV_VERSION=5.2.5.Final
- HV_VERSION=5.3.5.Final
- HV_VERSION=5.4.1.Final
- HV_GROUP_ID=org.hibernate HV_VERSION=4.3.2.Final
- HV_GROUP_ID=org.hibernate HV_VERSION=5.0.3.Final DEPLOY=yes
- HV_GROUP_ID=org.hibernate HV_VERSION=5.1.3.Final
- HV_GROUP_ID=org.hibernate HV_VERSION=5.2.5.Final
- HV_GROUP_ID=org.hibernate HV_VERSION=5.3.5.Final
- HV_GROUP_ID=org.hibernate HV_VERSION=5.4.1.Final
- HV_GROUP_ID=org.hibernate.validator HV_VERSION=6.0.0.Final
- HV_GROUP_ID=org.hibernate.validator HV_VERSION=6.0.3.Final
- HV_GROUP_ID=org.hibernate.validator HV_VERSION=6.0.4.Final

# Cache local Maven repository
cache:
Expand All @@ -22,9 +24,9 @@ before_cache:
- rm -Rf ~/.m2/repository/cz/jirutka/validator/validator-collection

install:
- mvn install -Ptest-different-hv-version -Dhv.version.test=${HV_VERSION} -DskipTests=true --batch-mode
- mvn install -Ptest-different-hv-version -Dhv.groupId.test=${HV_GROUP_ID} -Dhv.version.test=${HV_VERSION} -DskipTests=true --batch-mode
script:
- mvn verify -Ptest-different-hv-version -Dhv.version.test=${HV_VERSION} --batch-mode
- mvn verify -Ptest-different-hv-version -Dhv.groupId.test=${HV_GROUP_ID} -Dhv.version.test=${HV_VERSION} --batch-mode
after_success:
- mvn jacoco:report coveralls:report

Expand Down
18 changes: 13 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
</issueManagement>


<!--//////////////////// PROPERTIES ////////////////////-->
<properties>
<groovy.version>2.4.15</groovy.version>
Copy link
Author

@Osguima3 Osguima3 Apr 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to parent pom.xml file, enables groovy tests to compile java 8 code.

</properties>


<!--//////////////////// DEPENDENCIES ////////////////////-->

<dependencies>
Expand All @@ -70,10 +76,10 @@

<!-- JSR-349 Bean Validator -->
<dependency>
<groupId>org.hibernate</groupId>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<!-- Note: Minimal supported version is 4.3.0.Final. -->
<version>5.4.1.Final</version>
<version>6.0.4.Final</version>
</dependency>

<dependency>
Expand All @@ -86,7 +92,7 @@
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -140,7 +146,8 @@
<id>test-different-hv-version</id>

<properties>
<!-- Should be set from CLI: -Dhv.version.test=VERSION -->
<!-- Should be set from CLI: -Dhv.groupId.test=GROUP_ID -Dhv.version.test=VERSION -->
<hv.groupId.test></hv.groupId.test>
<hv.version.test></hv.version.test>
<dependency.directory>${project.build.directory}/dependency</dependency.directory>
</properties>
Expand All @@ -158,7 +165,7 @@
<outputDirectory>${dependency.directory}</outputDirectory>
<artifactItems>
<item>
<groupId>org.hibernate</groupId>
<groupId>${hv.groupId.test}</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hv.version.test}</version>
</item>
Expand All @@ -173,6 +180,7 @@
<configuration>
<classpathDependencyExcludes>
<exclude>org.hibernate:hibernate-validator</exclude>
<exclude>org.hibernate.validator:hibernate-validator</exclude>
</classpathDependencyExcludes>
<additionalClasspathElements>
<element>${dependency.directory}/hibernate-validator-${hv.version.test}.jar</element>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* The MIT License
*
* Copyright 2013-2014 Jakub Jirutka <jakub@jirutka.cz>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;
import org.hibernate.validator.constraints.CodePointLength;
import org.hibernate.validator.constraints.CodePointLength.NormalizationStrategy;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* @since Hibernate Validator 6.0.3
* @see CodePointLength
* @see CommonEachValidator
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
@EachConstraint(validateAs = CodePointLength.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachCodePointLength {

String message() default "";

Class<?>[] groups() default { };

Class<? extends Payload>[] payload() default { };

int min() default 0;

int max() default Integer.MAX_VALUE;

NormalizationStrategy normalizationStrategy() default NormalizationStrategy.NONE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE})
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@EachConstraint(validateAs = Email.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachEmail {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* The MIT License
*
* Copyright 2013-2014 Jakub Jirutka <jakub@jirutka.cz>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.FutureOrPresent;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* @see FutureOrPresent
* @see CommonEachValidator
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@EachConstraint(validateAs = FutureOrPresent.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachFutureOrPresent {

String message() default "";

Class<?>[] groups() default { };

Class<? extends Payload>[] payload() default { };
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
Class<? extends Payload>[] payload() default { };

/**
* @return The threshold for the Mod11 algorithm multiplier growth, if no value is specified the multiplier will grow indefinitely
* @return The threshold for the Mod11 algorithm multiplier growth, if no value is specified the multiplier will
* grow indefinitely
*/
int threshold() default Integer.MAX_VALUE;

Expand All @@ -71,8 +72,8 @@

/**
* @return The index of the check digit in the input. Per default it is assumed that the check digit is the last
* digit of the specified range. If set, the digit at the specified index is used. If set
* the following must hold true:<br/>
* digit of the specified range. If set, the digit at the specified index is used. If set the following must hold
* true:<br/>
* {@code checkDigitIndex > 0 && (checkDigitIndex < startIndex || checkDigitIndex >= endIndex}.
*/
int checkDigitIndex() default -1;
Expand All @@ -96,7 +97,8 @@
char treatCheck11As() default '0';

/**
* @return Returns {@code RIGHT_TO_LEFT} if the Mod11 checksum must be done from the rightmost to the leftmost digit.
* @return Returns {@code RIGHT_TO_LEFT} if the Mod11 checksum must be done from the rightmost to the leftmost
* digit.
* e.g. Code 12345-?:
* <ul>
* <li>{@code RIGHT_TO_LEFT} the sum (5*2 + 4*3 + 3*4 + 2*5 + 1*6) with check digit 5</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* The MIT License
*
* Copyright 2013-2014 Jakub Jirutka <jakub@jirutka.cz>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.Negative;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* @see Negative
* @see CommonEachValidator
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@EachConstraint(validateAs = Negative.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachNegative {

String message() default "";

Class<?>[] groups() default { };

Class<? extends Payload>[] payload() default { };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* The MIT License
*
* Copyright 2013-2014 Jakub Jirutka <jakub@jirutka.cz>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.NegativeOrZero;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* @see NegativeOrZero
* @see CommonEachValidator
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@EachConstraint(validateAs = NegativeOrZero.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachNegativeOrZero {

String message() default "";

Class<?>[] groups() default { };

Class<? extends Payload>[] payload() default { };
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
*/
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.ReportAsSingleViolation;
import javax.validation.constraints.NotEmpty;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
Expand All @@ -34,11 +37,12 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* @see org.hibernate.validator.constraints.NotEmpty
* @see NotEmpty
* @see CommonEachValidator
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE})
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@EachNotNull
@EachSize(min = 1)
@ReportAsSingleViolation
Expand Down
Loading