You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ra...@apache.org on 2018/10/12 15:00:51 UTC
svn commit: r1843674 [17/22] - in /tomee/deps/branches/bval-2: ./ bundle/
bundle/src/ bundle/src/main/ bundle/src/main/appended-resources/
bundle/src/main/appended-resources/META-INF/ bval-extras/ bval-extras/src/
bval-extras/src/main/ bval-extras/src/...
Added: tomee/deps/branches/bval-2/bval-jsr/src/main/xjb/binding-customization.xjb
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/main/xjb/binding-customization.xjb?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/main/xjb/binding-customization.xjb (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/main/xjb/binding-customization.xjb Fri Oct 12 15:00:48 2018
@@ -0,0 +1,38 @@
+<?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.
+-->
+<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
+ <jxb:bindings schemaLocation="../xsd/validation-mapping-2.0.xsd" node="/xs:schema">
+ <jxb:globalBindings>
+ <xjc:javaType name="java.lang.String" xmlType="xs:string"
+ adapter="javax.xml.bind.annotation.adapters.CollapsedStringAdapter"/>
+ </jxb:globalBindings>
+
+ <jxb:bindings node="//xs:complexType[@name='beanType']/xs:sequence[1]/xs:element[1]">
+ <jxb:property name="classType"/>
+ </jxb:bindings>
+ </jxb:bindings>
+ <jxb:bindings schemaLocation="../xsd/validation-configuration-2.0.xsd" node="/xs:schema">
+ <jxb:bindings node="//xs:element[@name='executable-type']">
+ <jxb:javaType name="javax.validation.executable.ExecutableType"
+ parseMethod="javax.validation.executable.ExecutableType.valueOf"/>
+ </jxb:bindings>
+ </jxb:bindings>
+</jxb:bindings>
Added: tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-1.0.xsd
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-1.0.xsd?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-1.0.xsd (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-1.0.xsd Fri Oct 12 15:00:48 2018
@@ -0,0 +1,45 @@
+<?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.
+-->
+<xs:schema attributeFormDefault="unqualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://jboss.org/xml/ns/javax/validation/configuration"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ version="1.0">
+ <xs:element name="validation-config" type="config:validation-configType"
+ xmlns:config="http://jboss.org/xml/ns/javax/validation/configuration"/>
+ <xs:complexType name="validation-configType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="default-provider" minOccurs="0"/>
+ <xs:element type="xs:string" name="message-interpolator" minOccurs="0"/>
+ <xs:element type="xs:string" name="traversable-resolver" minOccurs="0"/>
+ <xs:element type="xs:string" name="constraint-validator-factory" minOccurs="0"/>
+ <xs:element type="xs:string" name="constraint-mapping" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="config:propertyType" name="property" maxOccurs="unbounded" minOccurs="0"
+ xmlns:config="http://jboss.org/xml/ns/javax/validation/configuration"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="propertyType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+</xs:schema>
Added: tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-1.1.xsd
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-1.1.xsd?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-1.1.xsd (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-1.1.xsd Fri Oct 12 15:00:48 2018
@@ -0,0 +1,74 @@
+<?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.
+-->
+<xs:schema attributeFormDefault="unqualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://jboss.org/xml/ns/javax/validation/configuration"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:config="http://jboss.org/xml/ns/javax/validation/configuration"
+ version="1.1">
+ <xs:element name="validation-config" type="config:validation-configType"
+ xmlns:config="http://jboss.org/xml/ns/javax/validation/configuration"/>
+ <xs:complexType name="validation-configType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="default-provider" minOccurs="0"/>
+ <xs:element type="xs:string" name="message-interpolator" minOccurs="0"/>
+ <xs:element type="xs:string" name="traversable-resolver" minOccurs="0"/>
+ <xs:element type="xs:string" name="constraint-validator-factory" minOccurs="0"/>
+ <xs:element type="xs:string" name="parameter-name-provider" minOccurs="0"/>
+ <xs:element type="config:executable-validationType" name="executable-validation" minOccurs="0"/>
+ <xs:element type="xs:string" name="constraint-mapping" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="config:propertyType" name="property" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="version" type="config:versionType" fixed="1.1" /> <!-- use="required" -->
+ </xs:complexType>
+ <xs:complexType name="executable-validationType">
+ <xs:sequence>
+ <xs:element type="config:default-validated-executable-typesType" name="default-validated-executable-types" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="enabled" use="optional" type="xs:boolean" default="true"/>
+ </xs:complexType>
+ <xs:complexType name="default-validated-executable-typesType">
+ <xs:sequence>
+ <xs:element name="executable-type" maxOccurs="unbounded" minOccurs="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="NONE"/>
+ <xs:enumeration value="CONSTRUCTORS"/>
+ <xs:enumeration value="NON_GETTER_METHODS"/>
+ <xs:enumeration value="GETTER_METHODS"/>
+ <xs:enumeration value="ALL"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="propertyType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:simpleType name="versionType">
+ <xs:restriction base="xs:token">
+ <xs:pattern value="[0-9]+(\.[0-9]+)*" />
+ </xs:restriction>
+ </xs:simpleType>
+</xs:schema>
Added: tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-2.0.xsd
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-2.0.xsd?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-2.0.xsd (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-configuration-2.0.xsd Fri Oct 12 15:00:48 2018
@@ -0,0 +1,75 @@
+<?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.
+-->
+<xs:schema attributeFormDefault="unqualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://xmlns.jcp.org/xml/ns/validation/configuration"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:config="http://xmlns.jcp.org/xml/ns/validation/configuration"
+ version="2.0">
+ <xs:element name="validation-config" type="config:validation-configType" />
+ <xs:complexType name="validation-configType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="default-provider" minOccurs="0" />
+ <xs:element type="xs:string" name="message-interpolator" minOccurs="0" />
+ <xs:element type="xs:string" name="traversable-resolver" minOccurs="0" />
+ <xs:element type="xs:string" name="constraint-validator-factory" minOccurs="0" />
+ <xs:element type="xs:string" name="parameter-name-provider" minOccurs="0" />
+ <xs:element type="xs:string" name="clock-provider" minOccurs="0" />
+ <xs:element type="xs:string" name="value-extractor" maxOccurs="unbounded" minOccurs="0" />
+ <xs:element type="config:executable-validationType" name="executable-validation" minOccurs="0" />
+ <xs:element type="xs:string" name="constraint-mapping" maxOccurs="unbounded" minOccurs="0" />
+ <xs:element type="config:propertyType" name="property" maxOccurs="unbounded" minOccurs="0" />
+ </xs:sequence>
+ <xs:attribute name="version" type="config:versionType" fixed="2.0" /> <!-- use="required" -->
+ </xs:complexType>
+ <xs:complexType name="executable-validationType">
+ <xs:sequence>
+ <xs:element type="config:default-validated-executable-typesType" name="default-validated-executable-types" minOccurs="0" />
+ </xs:sequence>
+ <xs:attribute name="enabled" use="optional" type="xs:boolean" default="true" />
+ </xs:complexType>
+ <xs:complexType name="default-validated-executable-typesType">
+ <xs:sequence>
+ <xs:element name="executable-type" maxOccurs="unbounded" minOccurs="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="NONE" />
+ <xs:enumeration value="CONSTRUCTORS" />
+ <xs:enumeration value="NON_GETTER_METHODS" />
+ <xs:enumeration value="GETTER_METHODS" />
+ <xs:enumeration value="ALL" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="propertyType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" use="required" type="xs:string" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:simpleType name="versionType">
+ <xs:restriction base="xs:token">
+ <xs:pattern value="[0-9]+(\.[0-9]+)*" />
+ </xs:restriction>
+ </xs:simpleType>
+</xs:schema>
Added: tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-1.0.xsd
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-1.0.xsd?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-1.0.xsd (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-1.0.xsd Fri Oct 12 15:00:48 2018
@@ -0,0 +1,171 @@
+<?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.
+-->
+<xs:schema attributeFormDefault="unqualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://jboss.org/xml/ns/javax/validation/mapping"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ version="1.0">
+ <xs:element name="constraint-mappings"
+ type="map:constraint-mappingsType"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+
+ <xs:complexType name="payloadType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="groupsType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="groupSequenceType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="constraint-mappingsType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="default-package" minOccurs="0"/>
+ <xs:element type="map:beanType"
+ name="bean"
+ maxOccurs="unbounded"
+ minOccurs="0"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ <xs:element type="map:constraint-definitionType"
+ name="constraint-definition"
+ maxOccurs="unbounded"
+ minOccurs="0"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="validated-byType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="include-existing-validators" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="constraintType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="message" minOccurs="0"/>
+ <xs:element type="map:groupsType"
+ name="groups"
+ minOccurs="0"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ <xs:element type="map:payloadType"
+ name="payload"
+ minOccurs="0"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ <xs:element type="map:elementType"
+ name="element"
+ maxOccurs="unbounded"
+ minOccurs="0"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="annotation" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="elementType" mixed="true">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="map:annotationType"
+ name="annotation"
+ maxOccurs="unbounded"
+ minOccurs="0"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="classType">
+ <xs:sequence>
+ <xs:element type="map:groupSequenceType"
+ name="group-sequence"
+ minOccurs="0"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ <xs:element type="map:constraintType"
+ name="constraint"
+ maxOccurs="unbounded"
+ minOccurs="0"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="beanType">
+ <xs:sequence>
+ <xs:element type="map:classType"
+ name="class"
+ minOccurs="0"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping">
+ </xs:element>
+ <xs:element type="map:fieldType"
+ name="field"
+ minOccurs="0"
+ maxOccurs="unbounded"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ <xs:element type="map:getterType"
+ name="getter"
+ minOccurs="0"
+ maxOccurs="unbounded"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="class" use="required"/>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="annotationType">
+ <xs:sequence>
+ <xs:element type="map:elementType"
+ name="element"
+ maxOccurs="unbounded"
+ minOccurs="0"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="getterType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="valid" minOccurs="0" fixed=""/>
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required"/>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="constraint-definitionType">
+ <xs:sequence>
+ <xs:element type="map:validated-byType"
+ name="validated-by"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="annotation" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="fieldType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="valid" minOccurs="0" fixed=""/>
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required"/>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+</xs:schema>
Added: tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-1.1.xsd
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-1.1.xsd?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-1.1.xsd (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-1.1.xsd Fri Oct 12 15:00:48 2018
@@ -0,0 +1,254 @@
+<?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.
+-->
+<xs:schema attributeFormDefault="unqualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://jboss.org/xml/ns/javax/validation/mapping"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:map="http://jboss.org/xml/ns/javax/validation/mapping"
+ version="1.1">
+ <xs:element name="constraint-mappings" type="map:constraint-mappingsType"/>
+
+ <xs:complexType name="payloadType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="groupsType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="groupSequenceType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="groupConversionType">
+ <xs:attribute type="xs:string" name="from" use="required"/>
+ <xs:attribute type="xs:string" name="to" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="constraint-mappingsType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="default-package" minOccurs="0"/>
+ <xs:element type="map:beanType"
+ name="bean"
+ maxOccurs="unbounded"
+ minOccurs="0"/>
+ <xs:element type="map:constraint-definitionType"
+ name="constraint-definition"
+ maxOccurs="unbounded"
+ minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="version" type="map:versionType" fixed="1.1" /> <!-- use="required" -->
+ </xs:complexType>
+ <xs:simpleType name="versionType">
+ <xs:restriction base="xs:token">
+ <xs:pattern value="[0-9]+(\.[0-9]+)*"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="validated-byType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="include-existing-validators" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="constraintType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="message" minOccurs="0"/>
+ <xs:element type="map:groupsType"
+ name="groups"
+ minOccurs="0"/>
+ <xs:element type="map:payloadType"
+ name="payload"
+ minOccurs="0"/>
+ <xs:element type="map:elementType"
+ name="element"
+ maxOccurs="unbounded"
+ minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="annotation" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="elementType" mixed="true">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="map:annotationType"
+ name="annotation"
+ maxOccurs="unbounded"
+ minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="classType">
+ <xs:sequence>
+ <xs:element type="map:groupSequenceType"
+ name="group-sequence"
+ minOccurs="0"/>
+ <xs:element type="map:constraintType"
+ name="constraint"
+ maxOccurs="unbounded"
+ minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="beanType">
+ <xs:sequence>
+ <xs:element type="map:classType"
+ name="class"
+ minOccurs="0">
+ </xs:element>
+ <xs:element type="map:fieldType"
+ name="field"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element type="map:getterType"
+ name="getter"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element type="map:constructorType"
+ name="constructor"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element type="map:methodType"
+ name="method"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="class" use="required"/>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="annotationType">
+ <xs:sequence>
+ <xs:element type="map:elementType"
+ name="element"
+ maxOccurs="unbounded"
+ minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="getterType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="valid" minOccurs="0" fixed=""/>
+ <xs:element type="map:groupConversionType"
+ name="convert-group"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required"/>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="methodType">
+ <xs:sequence>
+ <xs:element type="map:parameterType"
+ name="parameter"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element type="map:crossParameterType"
+ name="cross-parameter"
+ minOccurs="0"
+ maxOccurs="1"/>
+ <xs:element type="map:returnValueType"
+ name="return-value"
+ minOccurs="0"
+ maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required"/>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="constructorType">
+ <xs:sequence>
+ <xs:element type="map:parameterType"
+ name="parameter"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element type="map:crossParameterType"
+ name="cross-parameter"
+ minOccurs="0"
+ maxOccurs="1"/>
+ <xs:element type="map:returnValueType"
+ name="return-value"
+ minOccurs="0"
+ maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="parameterType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="valid" minOccurs="0" fixed=""/>
+ <xs:element type="map:groupConversionType"
+ name="convert-group"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="type" use="required"/>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="returnValueType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="valid" minOccurs="0" fixed=""/>
+ <xs:element type="map:groupConversionType"
+ name="convert-group"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="crossParameterType">
+ <xs:sequence>
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="constraint-definitionType">
+ <xs:sequence>
+ <xs:element type="map:validated-byType"
+ name="validated-by"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="annotation" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="fieldType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="valid" minOccurs="0" fixed=""/>
+ <xs:element type="map:groupConversionType"
+ name="convert-group"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required"/>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional"/>
+ </xs:complexType>
+</xs:schema>
Added: tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-2.0.xsd
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-2.0.xsd?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-2.0.xsd (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/main/xsd/validation-mapping-2.0.xsd Fri Oct 12 15:00:48 2018
@@ -0,0 +1,297 @@
+<?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.
+-->
+<xs:schema attributeFormDefault="unqualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://xmlns.jcp.org/xml/ns/validation/mapping"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:map="http://xmlns.jcp.org/xml/ns/validation/mapping"
+ version="2.0">
+ <xs:element name="constraint-mappings" type="map:constraint-mappingsType" />
+
+ <xs:complexType name="payloadType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="groupsType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="groupSequenceType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="groupConversionType">
+ <xs:attribute type="xs:string" name="from" use="optional" />
+ <xs:attribute type="xs:string" name="to" use="required" />
+ </xs:complexType>
+ <xs:complexType name="constraint-mappingsType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="default-package" minOccurs="0" />
+ <xs:element type="map:beanType"
+ name="bean"
+ maxOccurs="unbounded"
+ minOccurs="0" />
+ <xs:element type="map:constraint-definitionType"
+ name="constraint-definition"
+ maxOccurs="unbounded"
+ minOccurs="0" />
+ </xs:sequence>
+ <xs:attribute name="version" type="map:versionType" fixed="2.0" /> <!-- use="required" -->
+ </xs:complexType>
+ <xs:simpleType name="versionType">
+ <xs:restriction base="xs:token">
+ <xs:pattern value="[0-9]+(\.[0-9]+)*" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="validated-byType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0" />
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="include-existing-validators" use="optional" />
+ </xs:complexType>
+ <xs:complexType name="constraintType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="message" minOccurs="0" />
+ <xs:element type="map:groupsType"
+ name="groups"
+ minOccurs="0" />
+ <xs:element type="map:payloadType"
+ name="payload"
+ minOccurs="0" />
+ <xs:element type="map:elementType"
+ name="element"
+ maxOccurs="unbounded"
+ minOccurs="0" />
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="annotation" use="required" />
+ </xs:complexType>
+ <xs:complexType name="elementType" mixed="true">
+ <xs:sequence>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0" />
+ <xs:element type="map:annotationType"
+ name="annotation"
+ maxOccurs="unbounded"
+ minOccurs="0" />
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required" />
+ </xs:complexType>
+ <xs:complexType name="containerElementTypeType">
+ <xs:sequence>
+ <xs:element type="xs:string"
+ name="valid"
+ minOccurs="0"
+ fixed="" />
+ <xs:element type="map:groupConversionType"
+ name="convert-group"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:containerElementTypeType"
+ name="container-element-type"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="type-argument-index" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:int">
+ <xs:minInclusive value="0" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ <xs:complexType name="classType">
+ <xs:sequence>
+ <xs:element type="map:groupSequenceType"
+ name="group-sequence"
+ minOccurs="0" />
+ <xs:element type="map:constraintType"
+ name="constraint"
+ maxOccurs="unbounded"
+ minOccurs="0" />
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional" />
+ </xs:complexType>
+ <xs:complexType name="beanType">
+ <xs:sequence>
+ <xs:element type="map:classType"
+ name="class"
+ minOccurs="0">
+ </xs:element>
+ <xs:element type="map:fieldType"
+ name="field"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:getterType"
+ name="getter"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:constructorType"
+ name="constructor"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:methodType"
+ name="method"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="class" use="required" />
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional" default="true" />
+ </xs:complexType>
+ <xs:complexType name="annotationType">
+ <xs:sequence>
+ <xs:element type="map:elementType"
+ name="element"
+ maxOccurs="unbounded"
+ minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="getterType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="valid" minOccurs="0" fixed="" />
+ <xs:element type="map:groupConversionType"
+ name="convert-group"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:containerElementTypeType"
+ name="container-element-type"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required" />
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional" />
+ </xs:complexType>
+ <xs:complexType name="methodType">
+ <xs:sequence>
+ <xs:element type="map:parameterType"
+ name="parameter"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:crossParameterType"
+ name="cross-parameter"
+ minOccurs="0"
+ maxOccurs="1" />
+ <xs:element type="map:returnValueType"
+ name="return-value"
+ minOccurs="0"
+ maxOccurs="1" />
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required" />
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional" />
+ </xs:complexType>
+ <xs:complexType name="constructorType">
+ <xs:sequence>
+ <xs:element type="map:parameterType"
+ name="parameter"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:crossParameterType"
+ name="cross-parameter"
+ minOccurs="0"
+ maxOccurs="1" />
+ <xs:element type="map:returnValueType"
+ name="return-value"
+ minOccurs="0"
+ maxOccurs="1" />
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional" />
+ </xs:complexType>
+ <xs:complexType name="parameterType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="valid" minOccurs="0" fixed="" />
+ <xs:element type="map:groupConversionType"
+ name="convert-group"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:containerElementTypeType"
+ name="container-element-type"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="type" use="required" />
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional" />
+ </xs:complexType>
+ <xs:complexType name="returnValueType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="valid" minOccurs="0" fixed="" />
+ <xs:element type="map:groupConversionType"
+ name="convert-group"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:containerElementTypeType"
+ name="container-element-type"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional" />
+ </xs:complexType>
+ <xs:complexType name="crossParameterType">
+ <xs:sequence>
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional" />
+ </xs:complexType>
+ <xs:complexType name="constraint-definitionType">
+ <xs:sequence>
+ <xs:element type="map:validated-byType"
+ name="validated-by" />
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="annotation" use="required" />
+ </xs:complexType>
+ <xs:complexType name="fieldType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="valid" minOccurs="0" fixed="" />
+ <xs:element type="map:groupConversionType"
+ name="convert-group"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:containerElementTypeType"
+ name="container-element-type"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element type="map:constraintType"
+ name="constraint"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="required" />
+ <xs:attribute type="xs:boolean" name="ignore-annotations" use="optional" />
+ </xs:complexType>
+</xs:schema>
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AssertFalseValidatorTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AssertFalseValidatorTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AssertFalseValidatorTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AssertFalseValidatorTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,54 @@
+/*
+ * 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.bval.constraints;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Checks correct behaviour of {@link AssertFalseValidator}.
+ * <p>
+ * Per the spec:
+ * <ul>
+ * <li>The annotated element must be false.</li>
+ * <li><code>null</code> elements are considered valid.</li>
+ * </ul>
+ *
+ * TODO: Mock context and verify that it's not used during validation.
+ *
+ * @see "bean_validation-1_0_CR1-pfd-spec#Chapter6#Example6.4"
+ *
+ * @author Carlos Vara
+ */
+public class AssertFalseValidatorTest {
+
+ /**
+ * Test {@link AssertFalseValidator} with <code>null</code> context.
+ */
+ @Test
+ public void testAssertFalseValidator() {
+ AssertFalseValidator afv = new AssertFalseValidator();
+ assertFalse("True value validation must fail", afv.isValid(true, null));
+ assertTrue("False value validation must succeed", afv.isValid(false, null));
+ assertTrue("Null value validation must succeed", afv.isValid(null, null));
+ }
+
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AssertTrueValidatorTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AssertTrueValidatorTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AssertTrueValidatorTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AssertTrueValidatorTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,54 @@
+/*
+ * 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.bval.constraints;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Checks correct behaviour of {@link AssertTrueValidator}.
+ * <p>
+ * Per the spec:
+ * <ul>
+ * <li>The annotated element must be true.</li>
+ * <li><code>null</code> elements are considered valid.</li>
+ * </ul>
+ *
+ * TODO: Mock context and verify that it's not used during validation.
+ *
+ * @see "bean_validation-1_0_CR1-pfd-spec#Chapter6#Example6.3"
+ *
+ * @author Carlos Vara
+ */
+public class AssertTrueValidatorTest {
+
+ /**
+ * Test {@link AssertTrueValidator} with null context.
+ */
+ @Test
+ public void testAssertTrueValidator() {
+ AssertTrueValidator atv = new AssertTrueValidator();
+ assertTrue("True value validation must succeed", atv.isValid(true, null));
+ assertFalse("False value validation must fail", atv.isValid(false, null));
+ assertTrue("Null value validation must succeed", atv.isValid(null, null));
+ }
+
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AuthorAddressKnown.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AuthorAddressKnown.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AuthorAddressKnown.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/AuthorAddressKnown.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,76 @@
+/*
+ * 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.bval.constraints;
+
+import org.apache.bval.jsr.example.Address;
+import org.apache.bval.jsr.example.Author;
+
+import javax.validation.Constraint;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.Payload;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ *
+ *
+ * @version $Rev: 999729 $ $Date: 2010-09-21 21:37:54 -0500 (Tue, 21 Sep 2010) $
+ */
+@Target({ ANNOTATION_TYPE, METHOD, FIELD })
+@Constraint(validatedBy = AuthorAddressKnown.Validator.class)
+@Retention(RUNTIME)
+public @interface AuthorAddressKnown {
+
+ String message() default "{org.apache.bval.constraints.AuthorAddressKnown.message}";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+
+ public static class Validator implements ConstraintValidator<AuthorAddressKnown, Author> {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void initialize(AuthorAddressKnown constraintAnnotation) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isValid(Author value, ConstraintValidatorContext context) {
+ if (value.getAddresses() == null) {
+ return false;
+ }
+ for (Address address : value.getAddresses()) {
+ if (address != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ }
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/CompanyEmail.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/CompanyEmail.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/CompanyEmail.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/CompanyEmail.java Fri Oct 12 15:00:48 2018
@@ -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.bval.constraints;
+
+import javax.validation.Constraint;
+import javax.validation.OverridesAttribute;
+import javax.validation.Payload;
+import javax.validation.constraints.Pattern;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+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.RetentionPolicy.RUNTIME;
+
+@Pattern.List({
+ // email
+ @Pattern(regexp = "[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}"),
+ // agimatec
+ @Pattern(regexp = ".*?COMPANY.*?") })
+/**
+ * test a constraint WITHOUT an own ConstraintValidator implementation.
+ * the validations, that must be processed are in the combined constraints only!!
+ * the @Constraint annotation is nevertheless required so that the framework searches
+ * for combined constraints.
+ */
+@Constraint(validatedBy = {})
+@Documented
+@Target({ ANNOTATION_TYPE, METHOD, FIELD, CONSTRUCTOR, PARAMETER })
+@Retention(RUNTIME)
+public @interface CompanyEmail {
+ String message() default "Not an email of COMPANY";
+
+ @OverridesAttribute(constraint = Pattern.class, name = "message", constraintIndex = 0)
+ String emailMessage() default "Not an email";
+
+ @OverridesAttribute(constraint = Pattern.class, name = "message", constraintIndex = 1)
+ String agimatecMessage() default "Not COMPANY";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+
+ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ @Retention(RUNTIME)
+ @Documented
+ @interface List {
+ CompanyEmail[] value();
+ }
+}
\ No newline at end of file
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,63 @@
+/*
+ * 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.bval.constraints;
+
+import static org.junit.Assert.assertFalse;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.constraints.DecimalMax;
+import javax.validation.constraints.DecimalMin;
+
+import org.apache.bval.jsr.ValidationTestBase;
+import org.junit.Test;
+
+/**
+ * Description: <br>
+ * User: roman.stumm<br>
+ * Date: 06.04.2010<br>
+ * Time: 13:45:09<br>
+ */
+public class DecimalMinMaxValidatorsTest extends ValidationTestBase {
+
+ @DecimalMin("922392239223.06")
+ public double dmin;
+ @DecimalMax("922392239223.09")
+ public double dmax;
+
+ @Test
+ public void testDecimalMinValue() {
+ this.dmin = 922392239223.05;
+ this.dmax = 922392239223.08;
+
+ Set<ConstraintViolation<DecimalMinMaxValidatorsTest>> res = validator.validate(this);
+ assertFalse("Min validation failed", res.isEmpty());
+ }
+
+ @Test
+ public void testDecimalMaxValue() {
+ this.dmin = Double.MAX_VALUE;
+ this.dmax = 922392239223.1;
+
+ Set<ConstraintViolation<DecimalMinMaxValidatorsTest>> res = validator.validate(this);
+ assertFalse("Max validation failed", res.isEmpty());
+ }
+
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/DigitsValidatorTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/DigitsValidatorTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/DigitsValidatorTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/DigitsValidatorTest.java Fri Oct 12 15:00:48 2018
@@ -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.bval.constraints;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.math.BigDecimal;
+
+import org.junit.Test;
+
+/**
+ * DigitsConstraintValidator Tester.
+ *
+ * @author <Authors name>
+ * @since <pre>02/03/2009</pre>
+ * @version 1.0
+ */
+public class DigitsValidatorTest {
+ @Test
+ public void testValidateNumber() {
+ DigitsValidatorForNumber validator = new DigitsValidatorForNumber();
+ validator.setFractional(4);
+ validator.setIntegral(2);
+ assertFalse(validator.isValid(new BigDecimal("100.1234"), null));
+ assertFalse(validator.isValid(new BigDecimal("99.12345"), null));
+ assertTrue(validator.isValid(new BigDecimal("99.1234"), null));
+ assertFalse(validator.isValid(Double.valueOf(100.1234), null));
+ assertFalse(validator.isValid(Double.valueOf(99.12345), null));
+ assertTrue(validator.isValid(Double.valueOf(99.1234), null));
+ assertTrue(validator.isValid(Double.valueOf(99.123400), null));
+ assertTrue(validator.isValid(new BigDecimal("99.123400"), null));
+ }
+
+ @Test
+ public void testValidateString() {
+ DigitsValidatorForString validator = new DigitsValidatorForString();
+ validator.setFractional(4);
+ validator.setIntegral(2);
+ assertFalse(validator.isValid("100.12345", null));
+ assertTrue(validator.isValid("99.1234", null));
+ }
+
+ @Test
+ public void testValidateNumber2() {
+ DigitsValidatorForNumber validator = new DigitsValidatorForNumber();
+ validator.setFractional(4);
+ validator.setIntegral(2);
+ assertFalse(validator.isValid(Long.valueOf("100"), null));
+ assertTrue(validator.isValid(Long.valueOf("99"), null));
+ }
+
+ @Test
+ public void testValidateString2() {
+ DigitsValidatorForString validator = new DigitsValidatorForString();
+ validator.setFractional(0);
+ validator.setIntegral(2);
+ assertFalse(validator.isValid("99.5", null));
+ assertTrue(validator.isValid("99", null));
+ }
+
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/EmailValidatorTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/EmailValidatorTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/EmailValidatorTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/EmailValidatorTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,96 @@
+/*
+ * 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.bval.constraints;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import javax.validation.Validator;
+
+import org.apache.bval.jsr.ApacheValidatorFactory;
+import org.apache.bval.jsr.example.Customer;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * EmailValidator Tester.
+ *
+ * @author Roman Stumm
+ * @version 1.0
+ * @since <pre>10/14/2008</pre>
+ */
+public class EmailValidatorTest {
+ public static class EmailAddressBuilder {
+ @Email
+ private StringBuilder buffer = new StringBuilder();
+
+ /**
+ * Get the buffer.
+ * @return StringBuilder
+ */
+ public StringBuilder getBuffer() {
+ return buffer;
+ }
+
+ }
+
+ private Validator validator;
+
+ @Before
+ public void setUp() throws Exception {
+ validator = ApacheValidatorFactory.getDefault().getValidator();
+ }
+
+ @Test
+ public void testEmail() {
+ Customer customer = new Customer();
+ customer.setCustomerId("id-1");
+ customer.setFirstName("Mary");
+ customer.setLastName("Do");
+ customer.setPassword("12345");
+
+ assertTrue(validator.validate(customer).isEmpty());
+
+ customer.setEmailAddress("some@invalid@address");
+ assertEquals(1, validator.validate(customer).size());
+
+ customer.setEmailAddress("some.valid-012345@address_at-test.org");
+ assertTrue(validator.validate(customer).isEmpty());
+
+ customer.setEmailAddress("permit^circumflex^aka^caret@address_at-test.org");
+ assertTrue(validator.validate(customer).isEmpty());
+ }
+
+ @Test
+ public void testEmailCharSequence() {
+ EmailAddressBuilder emailAddressBuilder = new EmailAddressBuilder();
+ assertTrue(validator.validate(emailAddressBuilder).isEmpty());
+ emailAddressBuilder.getBuffer().append("foo");
+ assertEquals(1, validator.validate(emailAddressBuilder).size());
+ emailAddressBuilder.getBuffer().append('@');
+ assertEquals(1, validator.validate(emailAddressBuilder).size());
+ emailAddressBuilder.getBuffer().append("bar");
+ assertTrue(validator.validate(emailAddressBuilder).isEmpty());
+ emailAddressBuilder.getBuffer().append('.');
+ assertEquals(1, validator.validate(emailAddressBuilder).size());
+ emailAddressBuilder.getBuffer().append("baz");
+ assertTrue(validator.validate(emailAddressBuilder).isEmpty());
+ }
+
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/FrenchZipCode.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/FrenchZipCode.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/FrenchZipCode.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/FrenchZipCode.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,61 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.Constraint;
+import javax.validation.OverridesAttribute;
+import javax.validation.Payload;
+import javax.validation.ReportAsSingleViolation;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Description: example for composed constraint.
+ * not implemented! simple dummy implementation for tests only! <br/>
+ */
+@NotEmpty
+@NotNull
+@Size(min = 4, max = 5, message = "Zipcode should be of size {value}")
+@Constraint(validatedBy = FrenchZipcodeValidator.class)
+@ReportAsSingleViolation
+@Documented
+@Target({ ANNOTATION_TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface FrenchZipCode {
+ @OverridesAttribute.List({ @OverridesAttribute(constraint = Size.class, name = "min"),
+ @OverridesAttribute(constraint = Size.class, name = "max") })
+ int size() default 6;
+
+ @OverridesAttribute(constraint = Size.class, name = "message")
+ String sizeMessage() default "{error.zipcode.size}";
+
+ String message() default "Wrong zipcode";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/FrenchZipcodeValidator.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/FrenchZipcodeValidator.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/FrenchZipcodeValidator.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/FrenchZipcodeValidator.java Fri Oct 12 15:00:48 2018
@@ -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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * Description: not implemented (test only)<br/>
+ */
+public class FrenchZipcodeValidator implements ConstraintValidator<FrenchZipCode, Object> {
+ @Override
+ public boolean isValid(Object object, ConstraintValidatorContext validationContext) {
+ return null != object;
+ }
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/HasStringValidator.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/HasStringValidator.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/HasStringValidator.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/HasStringValidator.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,41 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+import org.apache.bval.util.ObjectUtils;
+
+/**
+ * Description: <br/>
+ */
+public class HasStringValidator implements ConstraintValidator<HasValue, String> {
+ private String[] values;
+
+ @Override
+ public void initialize(HasValue stringValues) {
+ values = stringValues.value();
+ }
+
+ @Override
+ public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
+ return s == null || ObjectUtils.arrayContains(values, s);
+ }
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/HasValue.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/HasValue.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/HasValue.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/HasValue.java Fri Oct 12 15:00:48 2018
@@ -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.bval.constraints;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Description: allow distinct string values for element (like enums) <br/>
+ */
+@Target({ ANNOTATION_TYPE, METHOD, FIELD })
+@Constraint(validatedBy = { HasStringValidator.class })
+@Retention(RUNTIME)
+public @interface HasValue {
+ String[] value();
+
+ String message() default "Wrong value, must be one of {value}";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,74 @@
+/*
+ * 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.bval.constraints;
+
+import static org.junit.Assert.assertFalse;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+
+import org.junit.Test;
+
+/**
+ * Check correct behaviour of {@link MinValidatorForNumber} and
+ * {@link MaxValidatorForNumber} on boundary values.
+ * <p/>
+ * The chosen numbers: 9223372036854775806l and 9223372036854775807l cast to the
+ * same double value.
+ *
+ * @author Carlos Vara
+ */
+public class MinMaxValidatorsForNumberTest {
+
+ @Min(value = 9223372036854775807l)
+ public long min;
+
+ @Max(value = 9223372036854775806l)
+ public long max;
+
+ @Test
+ public void testMinBoundaryValue() {
+ Validator v = Validation.buildDefaultValidatorFactory().getValidator();
+
+ this.min = 9223372036854775806l;
+ this.max = 0l;
+
+ // Current min value is smaller, should fail, but it doesn't
+ Set<ConstraintViolation<MinMaxValidatorsForNumberTest>> res = v.validate(this);
+ assertFalse("Min validation failed", res.isEmpty());
+ }
+
+ @Test
+ public void testMaxBoundaryValue() {
+ Validator v = Validation.buildDefaultValidatorFactory().getValidator();
+
+ this.min = Long.MAX_VALUE;
+ this.max = 9223372036854775807l;
+
+ // Current max value is bigger, should fail, but it doesn't
+ Set<ConstraintViolation<MinMaxValidatorsForNumberTest>> res = v.validate(this);
+ assertFalse("Max validation failed", res.isEmpty());
+ }
+
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/NotNullValidatorTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/NotNullValidatorTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/NotNullValidatorTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/NotNullValidatorTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,52 @@
+/*
+ * 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.bval.constraints;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Checks correct behaviour of {@link NotNullValidator}.
+ * <p>
+ * Per the spec:
+ * <ul>
+ * <li>The annotated element must not be null.</li>
+ * </ul>
+ *
+ * TODO: Mock context and verify that it's not used during validation.
+ *
+ * @see "bean_validation-1_0_CR1-pfd-spec#Chapter6#Example6.2"
+ *
+ * @author Carlos Vara
+ */
+public class NotNullValidatorTest {
+
+ /**
+ * Test {@link NotNullValidator} with null context.
+ */
+ @Test
+ public void testNotNullValidator() {
+ NotNullValidator nnv = new NotNullValidator();
+ assertTrue("Non null value validation must succeed", nnv.isValid("hello", null));
+ assertFalse("Null value validation must fail", nnv.isValid(null, null));
+ }
+
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/NullValidatorTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/NullValidatorTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/NullValidatorTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/NullValidatorTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,52 @@
+/*
+ * 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.bval.constraints;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Checks correct behaviour of {@link NullValidator}.
+ * <p>
+ * Per the spec:
+ * <ul>
+ * <li>The annotated element must be null.</li>
+ * </ul>
+ *
+ * TODO: Mock context and verify that it's not used during validation.
+ *
+ * @see "bean_validation-1_0_CR1-pfd-spec#Chapter6#Example6.1"
+ *
+ * @author Carlos Vara
+ */
+public class NullValidatorTest {
+
+ /**
+ * Test {@link AssertFalseValidator} with null context.
+ */
+ @Test
+ public void testNullValidator() {
+ NullValidator nv = new NullValidator();
+ assertTrue("Null value validation must succeed", nv.isValid(null, null));
+ assertFalse("Non null value validation must fail", nv.isValid("hello", null));
+ }
+
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/Password.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/Password.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/Password.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/Password.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,49 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.lang.annotation.Retention;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Description: <br/>
+ * User: roman.stumm <br/>
+ * Date: 01.04.2008 <br/>
+ * Time: 12:02:06 <br/>
+ */
+@NotEmpty
+@NotNull
+@Size(min = 4, max = 5)
+@Retention(RUNTIME)
+@Constraint(validatedBy = {})
+// test that Password is validated although only combined constraints exists, no own implementation
+public @interface Password {
+ Class<?>[] groups() default {};
+
+ String message() default "Wrong password";
+
+ int robustness() default 8;
+
+ Class<? extends Payload>[] payload() default {};
+}
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/ZipCodeCityCoherence.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/ZipCodeCityCoherence.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/ZipCodeCityCoherence.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/constraints/ZipCodeCityCoherence.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,43 @@
+/*
+ * 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.bval.constraints;
+
+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.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * not implemented! simple dummy implemenation for tests only!
+ */
+@Documented
+@Constraint(validatedBy = ZipCodeCityCoherenceValidator.class)
+@Target({ TYPE })
+@Retention(RUNTIME)
+public @interface ZipCodeCityCoherence {
+ String message() default "{validator.zipCodeCityCoherence}";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+}