Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/Jsr303Test.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/Jsr303Test.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/Jsr303Test.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/Jsr303Test.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,224 @@
+/*
+ * 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.jsr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintViolation;
+import javax.validation.UnexpectedTypeException;
+import javax.validation.constraints.Max;
+import javax.validation.metadata.BeanDescriptor;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.metadata.ElementDescriptor;
+import javax.validation.metadata.PropertyDescriptor;
+
+import org.apache.bval.constraints.SizeValidator;
+import org.apache.bval.jsr.example.Address;
+import org.apache.bval.jsr.example.Book;
+import org.apache.bval.jsr.example.Engine;
+import org.apache.bval.jsr.example.IllustratedBook;
+import org.apache.bval.jsr.example.MaxTestEntity;
+import org.apache.bval.jsr.example.NoValidatorTestEntity;
+import org.apache.bval.jsr.example.Second;
+import org.apache.bval.jsr.example.SizeTestEntity;
+import org.apache.bval.jsr.util.TestUtils;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+/**
+ * Description: <br/>
+ */
+public class Jsr303Test extends ValidationTestBase {
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    @Test
+    public void testPropertyDescriptorHasConstraints() {
+        BeanDescriptor cons = validator.getConstraintsForClass(Book.class);
+        assertTrue(cons.getConstraintsForProperty("author").hasConstraints());
+        assertTrue(cons.getConstraintsForProperty("title").hasConstraints());
+        
assertTrue(cons.getConstraintsForProperty("uselessField").hasConstraints());
+        // cons.getConstraintsForProperty("unconstraintField") == null without
+        // Introspector
+        // cons.getConstraintsForProperty("unconstraintField") != null with
+        // Introspector
+        assertTrue(cons.getConstraintsForProperty("unconstraintField") == null
+            || 
!cons.getConstraintsForProperty("unconstraintField").hasConstraints());
+        assertNull(cons.getConstraintsForProperty("unknownField"));
+    }
+
+    @Test
+    public void testValidateValue() {
+        assertTrue(validator.validateValue(Book.class, "subtitle", 
"123456789098765432").isEmpty());
+        assertFalse(validator.validateValue(Book.class, "subtitle",
+            
"123456789098765432123412345678909876543212341234564567890987654321234", 
Second.class).isEmpty());
+        // tests for issue 22: validation of a field without any constraints
+        assertTrue(validator.validateValue(Book.class, "unconstraintField", 
4).isEmpty());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testUnknownProperty() {
+        // tests for issue 22: validation of unknown field cause
+        // ValidationException
+        validator.validateValue(Book.class, "unknownProperty", 4);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    @Ignore
+    public void testValidateNonCascadedRealNestedProperty() {
+        validator.validateValue(IllustratedBook.class, 
"illustrator.firstName", "Edgar");
+    }
+
+    @Test
+    public void testMetadataAPI_Book() {
+        assertNotNull(validator.getConstraintsForClass(Book.class));
+        // not necessary for implementation correctness, but we'll test
+        // nevertheless:
+        assertSame(validator.getConstraintsForClass(Book.class), 
validator.getConstraintsForClass(Book.class));
+        BeanDescriptor bc = validator.getConstraintsForClass(Book.class);
+        assertEquals(Book.class, bc.getElementClass());
+        assertNotNull(bc.getConstraintDescriptors());
+        TestUtils.failOnModifiable(bc.getConstraintDescriptors(), 
"beanDescriptor constraintDescriptors");
+    }
+
+    @Test
+    public void testMetadataAPI_Engine() {
+        ElementDescriptor desc =
+            
validator.getConstraintsForClass(Engine.class).getConstraintsForProperty("serialNumber");
+        assertNotNull(desc);
+        assertEquals(String.class, desc.getElementClass());
+    }
+
+    @Test
+    public void testMetadataAPI_Address() {
+        
assertFalse(validator.getConstraintsForClass(Address.class).getConstraintDescriptors().isEmpty());
+
+        Set<PropertyDescriptor> props = 
validator.getConstraintsForClass(Address.class).getConstrainedProperties();
+        TestUtils.failOnModifiable(props, "beanDescriptor 
constrainedProperties");
+        Set<String> propNames = new HashSet<String>(props.size());
+        for (PropertyDescriptor each : props) {
+            TestUtils.failOnModifiable(each.getConstraintDescriptors(), 
"propertyDescriptor constraintDescriptors");
+            propNames.add(each.getPropertyName());
+        }
+        assertTrue(propNames.contains("addressline1")); // annotated at
+        // field level
+        assertTrue(propNames.contains("addressline2"));
+        assertTrue(propNames.contains("zipCode"));
+        assertTrue(propNames.contains("country"));
+        assertTrue(propNames.contains("city")); // annotated at method
+        // level
+        assertEquals(5, props.size());
+
+        ElementDescriptor desc =
+            
validator.getConstraintsForClass(Address.class).getConstraintsForProperty("addressline1");
+        assertNotNull(desc);
+        boolean found = false;
+
+        for (ConstraintDescriptor<?> each : desc.getConstraintDescriptors()) {
+            if 
(each.getConstraintValidatorClasses().contains(SizeValidator.ForCharSequence.class))
 {
+                assertTrue(each.getAttributes().containsKey("max"));
+                assertEquals(30, each.getAttributes().get("max"));
+                found = true;
+            }
+        }
+        assertTrue(found);
+    }
+
+    @Test
+    public void testValidateMultiValuedConstraints() {
+        Engine engine = new Engine();
+        engine.serialNumber = "abcd-defg-0123";
+        Set<ConstraintViolation<Engine>> violations;
+        violations = validator.validate(engine);
+        assertEquals(0, violations.size());
+
+        engine.serialNumber = "!)/(/()";
+        violations = validator.validate(engine);
+        assertEquals(2, violations.size());
+        for (String msg : Arrays.asList("must contain alphabetical characters 
only", "must match ....-....-....")) {
+            assertNotNull(TestUtils.getViolationWithMessage(violations, msg));
+        }
+    }
+
+    @Test
+    public void testConstraintValidatorResolutionAlgorithm() {
+        MaxTestEntity entity = new MaxTestEntity();
+        entity.setText("101");
+        entity.setProperty("201");
+        entity.setLongValue(301);
+        entity.setDecimalValue(new BigDecimal(401));
+        Set<ConstraintViolation<MaxTestEntity>> violations = 
validator.validate(entity);
+        assertEquals(4, violations.size());
+    }
+
+    @Test
+    public void testConstraintValidatorResolutionAlgorithm2() {
+        thrown.expect(UnexpectedTypeException.class);
+        thrown.expectMessage(String.format("No compliant %s %s found for 
annotated element of type %s",
+            Max.class.getName(), ConstraintValidator.class.getSimpleName(), 
Object.class.getName()));
+        NoValidatorTestEntity entity2 = new NoValidatorTestEntity();
+        validator.validate(entity2);
+    }
+
+    @Test
+    public void testSizeValidation() {
+        SizeTestEntity en = new SizeTestEntity();
+        en.ba = new byte[3];
+        en.ca = new char[3];
+        en.boa = new boolean[3];
+        en.coll = Arrays.asList("1", "2", "3");
+        en.da = new double[3];
+        en.fa = new float[3];
+        en.it = new int[3];
+        en.la = new long[3];
+        en.map = new HashMap<String, String>();
+        en.map.put("1", "1");
+        en.map.put("3", "3");
+        en.map.put("2", "2");
+        en.oa = new Integer[3];
+        en.oa2 = new Integer[3];
+        en.sa = new short[3];
+        en.text = "123";
+        Set<ConstraintViolation<SizeTestEntity>> vi = validator.validate(en);
+        assertEquals(13, vi.size());
+    }
+
+    /**
+     * JSR-303 Section 5.1.c, IllegalArgumentException should be thrown
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testGetConstraintsForNullClass() {
+        validator.getConstraintsForClass(null);
+    }
+
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/PayloadTest.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/PayloadTest.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/PayloadTest.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/PayloadTest.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,85 @@
+/*
+ * 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.jsr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Payload;
+import javax.validation.constraints.NotNull;
+
+import org.apache.bval.jsr.util.TestUtils;
+import org.junit.Test;
+
+/**
+ * Description: test that payload information can be retrieved
+ * from error reports via the ConstraintDescriptor either accessed
+ * through the ConstraintViolation objects<br/>
+ */
+public class PayloadTest extends ValidationTestBase {
+
+    static class Severity {
+        static class Info implements Payload {
+        }
+
+        static class Error implements Payload {
+        }
+    }
+
+    static class Address {
+        private String zipCode;
+        private String city;
+
+        Address(String zipCode, String city) {
+            this.zipCode = zipCode;
+            this.city = city;
+        }
+
+        @NotNull(message = "would be nice if we had one", payload = 
Severity.Info.class)
+        public String getZipCode() {
+            return zipCode;
+        }
+
+        @NotNull(message = "the city is mandatory", payload = 
Severity.Error.class)
+        public String getCity() {
+            return city;
+        }
+    }
+
+    @Test
+    public void testPayload() {
+        Address address = new Address(null, null);
+        final Set<ConstraintViolation<Address>> violations = 
validator.validate(address);
+        assertEquals(2, violations.size());
+
+        final ConstraintViolation<?> zipViolation = 
TestUtils.getViolation(violations, "zipCode");
+        assertNotNull(zipViolation);
+        assertEquals(1, 
zipViolation.getConstraintDescriptor().getPayload().size());
+        
assertTrue(zipViolation.getConstraintDescriptor().getPayload().contains(Severity.Info.class));
+
+        final ConstraintViolation<?> cityViolation = 
TestUtils.getViolation(violations, "city");
+        assertNotNull(cityViolation);
+        assertEquals(1, 
cityViolation.getConstraintDescriptor().getPayload().size());
+        
assertTrue(cityViolation.getConstraintDescriptor().getPayload().contains(Severity.Error.class));
+    }
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/TckReproducerTest.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/TckReproducerTest.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/TckReproducerTest.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/TckReproducerTest.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,81 @@
+/*
+ *  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.jsr;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.constraints.Pattern;
+
+import org.junit.Test;
+
+/**
+ * Description: <br>
+ * User: roman.stumm<br>
+ * Date: 21.04.2010<br>
+ * Time: 14:21:45<br>
+ */
+public class TckReproducerTest extends ValidationTestBase {
+
+    private static <T> void 
assertCorrectNumberOfViolations(Set<ConstraintViolation<T>> violations,
+        int expectedViolations) {
+        assertEquals(
+            "Wrong number of constraint violations. Expected: " + 
expectedViolations + " Actual: " + violations.size(),
+            expectedViolations, violations.size());
+    }
+
+//    @Test
+//    public void testPropertyAccessOnNonPublicClass() throws Exception {
+//        Car car = new Car("USd-298");
+//        assertEquals(car.getLicensePlateNumber(), 
PropertyAccess.getProperty(car, "licensePlateNumber"));
+//
+//        assertCorrectNumberOfViolations(validator.validateProperty(car, 
"licensePlateNumber", First.class,
+//            org.apache.bval.jsr.example.Second.class), 1);
+//
+//        car.setLicensePlateNumber("USD-298");
+//        assertCorrectNumberOfViolations(validator.validateProperty(car, 
"licensePlateNumber", First.class,
+//            org.apache.bval.jsr.example.Second.class), 0);
+//    }
+
+    static class Car {
+        @Pattern(regexp = "[A-Z][A-Z][A-Z]-[0-9][0-9][0-9]", groups = { 
First.class, Second.class })
+        private String licensePlateNumber;
+
+        Car(String licensePlateNumber) {
+            this.licensePlateNumber = licensePlateNumber;
+        }
+
+        public String getLicensePlateNumber() {
+            return licensePlateNumber;
+        }
+
+        public void setLicensePlateNumber(String licensePlateNumber) {
+            this.licensePlateNumber = licensePlateNumber;
+        }
+    }
+
+    interface First {
+    }
+
+    interface Second {
+    }
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidationTest.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidationTest.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidationTest.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidationTest.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,743 @@
+/*
+ * 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.jsr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.constraints.AssertTrue;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.validation.groups.Default;
+import javax.validation.metadata.BeanDescriptor;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.metadata.PropertyDescriptor;
+
+import org.apache.bval.constraints.NotNullValidator;
+import org.apache.bval.jsr.example.AccessTestBusinessObject;
+import org.apache.bval.jsr.example.AccessTestBusinessObjectSub;
+import org.apache.bval.jsr.example.Address;
+import org.apache.bval.jsr.example.Author;
+import org.apache.bval.jsr.example.Book;
+import org.apache.bval.jsr.example.BusinessAddress;
+import org.apache.bval.jsr.example.Continent;
+import org.apache.bval.jsr.example.Country;
+import org.apache.bval.jsr.example.First;
+import org.apache.bval.jsr.example.Last;
+import org.apache.bval.jsr.example.RecursiveFoo;
+import org.apache.bval.jsr.util.TestUtils;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Description: <br/>
+ */
+public class ValidationTest extends ValidationTestBase {
+
+    @Before
+    public void testCache() {
+        
factory.getValidator().getConstraintsForClass(AccessTestBusinessObject.class);
+        
factory.getValidator().getConstraintsForClass(AccessTestBusinessObject.class);
+    }
+
+    @Test
+    @Ignore // per spec, fields should after all be validated on subclasses
+    public void testAccessStrategies_field_method() {
+        AccessTestBusinessObject o1 = new AccessTestBusinessObject("1");
+        assertTrue(validator.validate(o1).isEmpty());
+
+        AccessTestBusinessObjectSub o2 = new AccessTestBusinessObjectSub("3");
+        assertTrue(validator.validate(o2).isEmpty());
+
+        o2 = new AccessTestBusinessObjectSub("1");
+        assertEquals(1, validator.validate(o2).size());
+
+        // assert, that getvar2() and getVar2() are both validated with their
+        // getter method
+        o2 = new AccessTestBusinessObjectSub("3");
+        o2.setVar2("1");
+        o2.setvar2("2");
+        assertEquals(2, validator.validate(o2).size());
+
+        o2.setvar2("5");
+        o2.setVar2("6");
+        assertTrue(validator.validate(o2).isEmpty());
+
+        o2.setvar2("5");
+        o2.setVar2("-1");
+        assertEquals(1, validator.validate(o2).size());
+    }
+
+    @Test
+    public void testAccessStrategies_on_children() {
+        AccessTestBusinessObject o1 = new AccessTestBusinessObject("1");
+        AccessTestBusinessObject o2 = new AccessTestBusinessObject("2");
+        o1.next(o2);
+        // assert, that field access 'next' is used and not getNext() is 
called!!!
+        assertEquals(1, validator.validate(o1).size());
+        o2 = new AccessTestBusinessObject("1");
+        o1.next(o2);
+        assertTrue(validator.validate(o1).isEmpty());
+
+        // assert that toBeIgnored not validated, because not annotated with 
@Valid
+        o1.setToBeIgnored(new AccessTestBusinessObject("99"));
+        assertTrue(validator.validate(o1).isEmpty());
+
+        o1.setNext(new AccessTestBusinessObject("99"));
+        assertEquals(1, validator.validate(o1).size());
+    }
+
+    @Test
+    public void testBook() {
+        Author author = new Author();
+        author.setLastName("Baudelaire");
+        author.setFirstName("");
+        Book book = new Book();
+        book.setAuthor(author);
+        book.setSubtitle("12345678900125678901234578901234567890");
+
+        // NotEmpty failure on the title field
+        Set<ConstraintViolation<Book>> errors = validator.validate(book, 
Book.All.class);
+        assertFalse(errors.isEmpty());
+
+        book.setTitle("Les fleurs du mal");
+        author.setCompany("Some random publisher with a very very very long 
name");
+
+        // author.firstName fails to pass the NotEmpty constraint
+        // author.company fails to pass the Size constraint
+    }
+
+    /**
+     * test: - dynamic resolution of associated object types. - inheritance of 
validation constraints - complex
+     * valiation, different groups, nested object net
+     */
+    @Test
+    public void testValidAnnotation() {
+        Author a = new Author();
+        a.setAddresses(new ArrayList<Address>());
+        BusinessAddress adr = new BusinessAddress();
+        adr.setCountry(new Country());
+        adr.setAddressline1("line1");
+        adr.setAddressline2("line2");
+
+        adr.setZipCode("1234567890123456789");
+        a.getAddresses().add(adr);
+
+        a.setFirstName("Karl");
+        a.setLastName("May");
+
+        Set<ConstraintViolation<Author>> found = validator.validate(a, 
Default.class, First.class, Last.class);
+        assertTrue(!found.isEmpty());
+        assertEquals(4, found.size());
+
+        adr.setCity("Berlin");
+        adr.setZipCode("12345");
+        adr.setCompany("apache");
+        found = validator.validate(a, Default.class, First.class, Last.class);
+        assertEquals(1, found.size());
+        ConstraintViolation<Author> ic = found.iterator().next();
+        assertEquals("addresses[0].country.name", 
ic.getPropertyPath().toString());
+    }
+
+    @Test
+    public void testPropertyPathWithIndex() {
+        Author a = new Author();
+        a.setAddresses(new ArrayList<Address>());
+        Address adr = new Address();
+        adr.setAddressline1("adr1");
+        adr.setCity("Santiago");
+        a.getAddresses().add(adr);
+        adr = new Address();
+        adr.setAddressline1("adr2");
+        adr.setCity("Havanna");
+        a.getAddresses().add(adr);
+        adr = new Address();
+        adr.setAddressline1("adr3");
+        adr.setCity("Trinidad");
+        a.getAddresses().add(adr);
+
+        Set<ConstraintViolation<Author>> constraints = validator.validate(a);
+        assertFalse(constraints.isEmpty());
+
+        assertPropertyPath("addresses[0].country", constraints);
+        assertPropertyPath("addresses[1].country", constraints);
+        assertPropertyPath("addresses[2].country", constraints);
+    }
+
+    /**
+     * Check correct path reporting when validating a set of beans.
+     */
+    @Test
+    public void testPropertyPathOnSet() {
+        Continent c = new Continent();
+        c.name = "c1";
+        Country country = new Country();
+        country.setISO2Code("xx");
+        country.setISO3Code("xxx");
+        country.setName(null);
+        c.countries.add(country);
+
+        Set<ConstraintViolation<Continent>> constraints = 
validator.validate(c);
+        assertEquals("Incorrect number of violations detected", 1, 
constraints.size());
+        assertPropertyPath("countries[].name", constraints);
+
+    }
+
+    private static <T> void assertPropertyPath(String propertyPath, 
Set<ConstraintViolation<T>> constraints) {
+        for (ConstraintViolation<T> each : constraints) {
+            if (each.getPropertyPath().toString().equals(propertyPath)) {
+                return;
+            }
+        }
+        fail(propertyPath + " not found in " + constraints);
+    }
+
+    @Test
+    public void testPropertyPathRecursive() {
+        RecursiveFoo foo1 = new RecursiveFoo(); // root
+        RecursiveFoo foo11 = new RecursiveFoo();
+        foo1.getFoos().add(foo11); // foos[0]
+        RecursiveFoo foo12 = new RecursiveFoo();
+        foo1.getFoos().add(foo12); // foos[1]
+        RecursiveFoo foo2 = new RecursiveFoo();
+        foo11.getFoos().add(foo2); // foos[0].foos[0]
+
+        Set<ConstraintViolation<RecursiveFoo>> constraints = 
validator.validate(foo1);
+        assertPropertyPath("foos[0].foos[0].foos", constraints);
+        assertPropertyPath("foos[1].foos", constraints);
+    }
+
+    @Test
+    public void testNullElementInCollection() {
+        RecursiveFoo foo = new RecursiveFoo();
+        foo.getFoos().add(new RecursiveFoo());
+        foo.getFoos().add(null);
+        assertFalse(validator.validate(foo).isEmpty());
+        // check that no nullpointer exception gets thrown
+    }
+
+    @Test
+    public void testGroups() {
+        final Author author = new Author();
+        author.setCompany("ACME");
+        final Book book = new Book();
+        book.setTitle("");
+        book.setAuthor(author);
+        boolean foundTitleConstraint = false;
+        Set<ConstraintViolation<Book>> constraintViolations = 
validator.validate(book, Book.All.class);
+        assertEquals(1, constraintViolations.size());
+        // assuming an english locale, the interpolated message is returned
+        for (ConstraintViolation<Book> constraintViolation : 
constraintViolations) {
+            if 
(Book.class.equals(constraintViolation.getRootBean().getClass())) {
+                assertEquals("may not be empty", 
constraintViolation.getMessage());
+                assertSame(book, constraintViolation.getRootBean());
+
+                // the offending property
+                if 
("title".equals(constraintViolation.getPropertyPath().toString())) {
+                    foundTitleConstraint = true;
+                    // the offending value
+                    assertEquals(book.getTitle(), 
constraintViolation.getInvalidValue());
+                }
+            }
+        }
+        assertTrue(foundTitleConstraint);
+    }
+
+    /**
+     * Example 2.14. Using the fluent API to build custom constraint 
violations. test that: the
+     * {@link org.apache.bval.constraints.ZipCodeCityCoherenceValidator} adds 
custom messages to the context and
+     * suppresses the default message
+     */
+    @Test
+    public void testConstraintValidatorContextFluentAPI() {
+        Address ad = new Address();
+        ad.setCity("error");
+        ad.setZipCode("error");
+        ad.setAddressline1("something");
+        ad.setCountry(new Country());
+        ad.getCountry().setName("something");
+        Set<ConstraintViolation<Address>> violations = validator.validate(ad);
+        assertEquals(2, violations.size());
+        for (ConstraintViolation<Address> each : violations) {
+            assertTrue(each.getMessage().endsWith(" not OK"));
+        }
+        assertNotNull(TestUtils.getViolation(violations, "city"));
+        assertNotNull(TestUtils.getViolation(violations, ""));
+    }
+
+    @Test
+    public void testValidateNestedPropertyPath()
+        throws InvocationTargetException, NoSuchMethodException, 
IllegalAccessException {
+        final String propPath = "addresses[0].country.ISO2Code";
+
+        Author author = new Author();
+        author.setAddresses(new ArrayList<Address>());
+        Address adr = new Address();
+        author.getAddresses().add(adr);
+        Country country = new Country();
+        adr.setCountry(country);
+        country.setISO2Code("too_long");
+
+        Set<ConstraintViolation<Author>> iv = 
validator.validateProperty(author, propPath);
+        assertEquals(1, iv.size());
+        ConstraintViolation<Author> vio = iv.iterator().next();
+        assertEquals(propPath, vio.getPropertyPath().toString());
+        assertSame(author, vio.getRootBean());
+        assertSame(author.getAddresses().get(0).getCountry(), 
vio.getLeafBean());
+
+        country.setISO2Code("23");
+        iv = validator.validateProperty(author, propPath);
+        assertTrue(iv.isEmpty());
+
+        iv = validator.validateValue(Author.class, propPath, "345");
+        assertEquals(1, iv.size());
+        vio = iv.iterator().next();
+        assertEquals(propPath, vio.getPropertyPath().toString());
+        assertNull(vio.getRootBean());
+        assertNull(vio.getLeafBean());
+
+        assertTrue(validator.validateValue(Author.class, propPath, 
"34").isEmpty());
+    }
+
+    @Test
+    public void testValidateCascadingNestedBean()
+        throws InvocationTargetException, NoSuchMethodException, 
IllegalAccessException {
+        final String propPath = "addresses[0]";
+
+        CascadingPropertyValidator v = 
validator.unwrap(CascadingPropertyValidator.class);
+        Author author = new Author();
+        author.setAddresses(new ArrayList<Address>());
+        Address adr = new Address();
+        author.getAddresses().add(adr);
+        Country country = new Country();
+        adr.setCity("dark");
+        adr.setCountry(country);
+
+        Set<ConstraintViolation<Author>> iv = v.validateProperty(author, 
propPath);
+        assertEquals(1, iv.size()); // null address line 1 (no cascade)
+
+        country.setISO2Code("too_long");
+        iv = v.validateProperty(author, propPath, true);
+        assertEquals(3, iv.size()); // null address line 1 + null
+        // country.name + too long
+        // country.iso2code
+
+        country.setISO2Code("23");
+        iv = v.validateProperty(author, propPath, true);
+        assertEquals(2, iv.size()); // null address line 1 + null
+        // country.name, country.iso2code
+        // fixed
+
+        Address value = new Address();
+        value.setCity("whatever");
+        value.setAddressline1("1 address line");
+        iv = v.validateValue(Author.class, propPath, value, true);
+        assertEquals(1, iv.size()); // null country
+
+        value.setCountry(new Country());
+        iv = v.validateValue(Author.class, propPath, value, true);
+        assertEquals(1, iv.size()); // null country.name
+
+        value.getCountry().setName("NWO");
+        iv = v.validateValue(Author.class, propPath, value, true);
+        assertEquals(0, iv.size());
+    }
+
+    @Test
+    public void testValidateCascadingNestedProperty()
+        throws InvocationTargetException, NoSuchMethodException, 
IllegalAccessException {
+        final String propPath = "addresses[0].country";
+
+        CascadingPropertyValidator v = 
validator.unwrap(CascadingPropertyValidator.class);
+        Author author = new Author();
+        author.setAddresses(new ArrayList<Address>());
+        Address adr = new Address();
+        author.getAddresses().add(adr);
+        Country country = new Country();
+        adr.setCity("dark");
+        adr.setCountry(country);
+
+        Set<ConstraintViolation<Author>> iv = v.validateProperty(author, 
propPath);
+        assertEquals(0, iv.size());
+
+        country.setISO2Code("too_long");
+        iv = v.validateProperty(author, propPath, true);
+        assertEquals(2, iv.size());
+        // country.name + too long
+        // country.iso2code
+
+        country.setISO2Code("23");
+        iv = v.validateProperty(author, propPath, true);
+        assertEquals(1, iv.size());
+        // country.name, country.iso2code
+
+        Country value = null;
+        iv = v.validateValue(Author.class, propPath, value, true);
+        assertEquals(1, iv.size()); // null country
+
+        value = new Country();
+        iv = v.validateValue(Author.class, propPath, value, true);
+        assertEquals(1, iv.size()); // null country.name
+
+        value.setName("NWO");
+        iv = v.validateValue(Author.class, propPath, value, true);
+        assertEquals(0, iv.size());
+    }
+
+    @Test
+    public void testValidateCascadingNestedTipProperty() {
+        final String propPath = "addresses[0].country.name";
+
+        CascadingPropertyValidator v = 
validator.unwrap(CascadingPropertyValidator.class);
+        Author author = new Author();
+        author.setAddresses(new ArrayList<Address>());
+        Address adr = new Address();
+        author.getAddresses().add(adr);
+        Country country = new Country();
+        adr.setCity("dark");
+        adr.setCountry(country);
+
+        Set<ConstraintViolation<Author>> iv = v.validateProperty(author, 
propPath);
+        assertEquals(1, iv.size());
+
+        iv = v.validateProperty(author, propPath, true);
+        assertEquals(1, iv.size());
+    }
+
+    @Test
+    public void testValidateCascadingKeyedElement()
+        throws InvocationTargetException, NoSuchMethodException, 
IllegalAccessException {
+        final String propPath = "[foo]";
+
+        CascadingPropertyValidator v = 
validator.unwrap(CascadingPropertyValidator.class);
+        final Address adr = new Address();
+        @SuppressWarnings("serial")
+        Object map = new HashMap<String, Address>() {
+            {
+                put("foo", adr);
+            }
+        };
+        Country country = new Country();
+        adr.setCity("dark");
+        adr.setCountry(country);
+        Set<ConstraintViolation<Object>> iv = v.validateProperty(map, 
propPath);
+        assertEquals(1, iv.size()); // null address line 1 (no cascade)
+
+        country.setISO2Code("too_long");
+        iv = v.validateProperty(map, propPath, true);
+        assertEquals(3, iv.size()); // null address line 1 + null
+        // country.name + too long
+        // country.iso2code
+
+        country.setISO2Code("23");
+        iv = v.validateProperty(map, propPath, true);
+        assertEquals(2, iv.size()); // null address line 1 + null
+        // country.name, country.iso2code
+        // fixed
+
+        Address value = new Address();
+        value.setCity("whatever");
+        value.setAddressline1("1 address line");
+
+        Set<?> iv2 = v.validateValue(map.getClass(), propPath, value, true);
+        assertEquals(1, iv2.size()); // null country
+
+        value.setCountry(new Country());
+        iv2 = v.validateValue(map.getClass(), propPath, value, true);
+        assertEquals(1, iv2.size()); // null country.name
+
+        value.getCountry().setName("NWO");
+        iv2 = v.validateValue(map.getClass(), propPath, value, true);
+        assertEquals(0, iv2.size());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testValidateCascadingKeyedGenericElement()
+        throws InvocationTargetException, NoSuchMethodException, 
IllegalAccessException {
+        final String propPath = "[foo]";
+
+        CascadingPropertyValidator v = 
validator.unwrap(CascadingPropertyValidator.class);
+        final Address adr = new Address();
+        Object map = new HashMap<String, Address>();
+        ((Map<String, Address>) map).put("foo", adr);
+        Country country = new Country();
+        adr.setCity("dark");
+        adr.setCountry(country);
+        Set<?> iv = v.validateProperty(map, propPath);
+        assertEquals(1, iv.size()); // null address line 1 (no cascade)
+
+        country.setISO2Code("too_long");
+        iv = v.validateProperty(map, propPath, true);
+        assertEquals(3, iv.size()); // null address line 1 + null
+        // country.name + too long
+        // country.iso2code
+
+        country.setISO2Code("23");
+        iv = v.validateProperty(map, propPath, true);
+        assertEquals(2, iv.size()); // null address line 1 + null
+        // country.name, country.iso2code
+        // fixed
+
+        Address value = new Address();
+        value.setCity("whatever");
+        value.setAddressline1("1 address line");
+
+        Set<?> iv2 = v.validateValue(Map.class, propPath, value, true);
+        assertEquals(1, iv2.size()); // null country
+
+        value.setCountry(new Country());
+        iv2 = v.validateValue(Map.class, propPath, value, true);
+        assertEquals(1, iv2.size()); // null country.name
+
+        value.getCountry().setName("NWO");
+        iv2 = v.validateValue(Map.class, propPath, value, true);
+        assertEquals(0, iv2.size());
+    }
+
+    @Test
+    public void testValidateCascadingIndexedElement()
+        throws InvocationTargetException, NoSuchMethodException, 
IllegalAccessException {
+        final String propPath = "[0]";
+        CascadingPropertyValidator v = 
validator.unwrap(CascadingPropertyValidator.class);
+        Address value = new Address();
+        value.setCity("whatever");
+        value.setAddressline1("1 address line");
+        Set<ConstraintViolation<Address[]>> iv;
+        Address[] array = { value };
+        iv = v.validateProperty(array, propPath, true);
+        assertEquals(1, iv.size()); // null country
+
+        value.setCountry(new Country());
+        iv = v.validateProperty(array, propPath, true);
+        assertEquals(1, iv.size()); // null country.name
+
+        value.getCountry().setName("NWO");
+        iv = v.validateProperty(array, propPath, true);
+        assertEquals(0, iv.size());
+
+        value = new Address();
+        value.setCity("whatever");
+        value.setAddressline1("1 address line");
+        Set<?> iv2;
+        iv2 = v.validateValue(array.getClass(), propPath, value, true);
+        assertEquals(1, iv2.size()); // null country
+
+        value.setCountry(new Country());
+        iv2 = v.validateValue(array.getClass(), propPath, value, true);
+        assertEquals(1, iv2.size()); // null country.name
+
+        value.getCountry().setName("NWO");
+        iv2 = v.validateValue(array.getClass(), propPath, value, true);
+        assertEquals(0, iv2.size());
+    }
+
+    @Test
+    public void testValidateCascadingIndexedGenericElement()
+        throws InvocationTargetException, NoSuchMethodException, 
IllegalAccessException {
+        final String propPath = "[0]";
+        CascadingPropertyValidator v = 
validator.unwrap(CascadingPropertyValidator.class);
+        Address value = new Address();
+        value.setCity("whatever");
+        value.setAddressline1("1 address line");
+        Set<?> iv;
+        Object list = Collections.singletonList(value);
+        iv = v.validateProperty(list, propPath, true);
+        assertEquals(1, iv.size()); // null country
+
+        value.setCountry(new Country());
+        iv = v.validateProperty(list, propPath, true);
+        assertEquals(1, iv.size()); // null country.name
+
+        value.getCountry().setName("NWO");
+        iv = v.validateProperty(list, propPath, true);
+        assertEquals(0, iv.size());
+
+        value = new Address();
+        value.setCity("whatever");
+        value.setAddressline1("1 address line");
+        Set<?> iv2;
+        iv2 = v.validateValue(List.class, propPath, value, true);
+        assertEquals(1, iv2.size()); // null country
+
+        value.setCountry(new Country());
+        iv2 = v.validateValue(List.class, propPath, value, true);
+        assertEquals(1, iv2.size()); // null country.name
+
+        value.getCountry().setName("NWO");
+        iv2 = v.validateValue(List.class, propPath, value, true);
+        assertEquals(0, iv2.size());
+    }
+
+    public interface Foo {
+    }
+
+    public static class FooAddress extends Address {
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        @NotNull(groups = Foo.class)
+        public String getCity() {
+            return super.getCity();
+        }
+    }
+
+    @Test
+    public void 
testValidateCascadingPropertyWithMultipleGroupsIgnoresSiblingProperties() {
+        final String propPath = "addresses[0].country";
+
+        CascadingPropertyValidator v = 
validator.unwrap(CascadingPropertyValidator.class);
+        Author author = new Author();
+        author.setAddresses(new ArrayList<Address>());
+        Address adr = new FooAddress();
+        author.getAddresses().add(adr);
+        Country country = new Country();
+        adr.setCountry(country);
+
+        Set<ConstraintViolation<Author>> iv = v.validateProperty(author, 
propPath, true, Default.class, Foo.class);
+        assertEquals(1, iv.size());
+    }
+
+    @Test
+    public void testMetadataAPI() {
+        BeanDescriptor bookBeanDescriptor = 
validator.getConstraintsForClass(Book.class);
+
+        // expect no constraints on Book's Class-Level
+        assertFalse(bookBeanDescriptor.hasConstraints());
+        // but there are constraints on Book's Property-Level
+        assertTrue(bookBeanDescriptor.isBeanConstrained());
+        assertTrue(bookBeanDescriptor.getConstraintDescriptors().isEmpty()); 
// no
+        // constraint
+        // more specifically "author" and "title"
+        assertEquals(4, bookBeanDescriptor.getConstrainedProperties().size());
+        // not a property
+        
assertNull(bookBeanDescriptor.getConstraintsForProperty("doesNotExist"));
+        // property with no constraint
+        
assertNull(bookBeanDescriptor.getConstraintsForProperty("description"));
+        PropertyDescriptor propertyDescriptor = 
bookBeanDescriptor.getConstraintsForProperty("title");
+        assertEquals(2, propertyDescriptor.getConstraintDescriptors().size());
+        assertEquals("title", propertyDescriptor.getPropertyName());
+        // assuming the implementation returns the NotEmpty constraint first
+        Iterator<ConstraintDescriptor<?>> iter = 
propertyDescriptor.getConstraintDescriptors().iterator();
+        ConstraintDescriptor<?> constraintDescriptor = null;
+        while (iter.hasNext()) {
+            constraintDescriptor = iter.next();
+            if 
(constraintDescriptor.getAnnotation().annotationType().equals(NotNull.class)) {
+                break;
+            }
+
+        }
+        assertNotNull(constraintDescriptor);
+        assertEquals(1, constraintDescriptor.getGroups().size()); // "first"
+        assertEquals(NotNullValidator.class, 
constraintDescriptor.getConstraintValidatorClasses().get(0));
+        // assuming the implementation returns the Size constraint first
+        propertyDescriptor = 
bookBeanDescriptor.getConstraintsForProperty("subtitle");
+        Iterator<ConstraintDescriptor<?>> iterator = 
propertyDescriptor.getConstraintDescriptors().iterator();
+        constraintDescriptor = iterator.next();
+        
assertTrue(constraintDescriptor.getAnnotation().annotationType().equals(Size.class));
+        assertEquals(30, ((Integer) 
constraintDescriptor.getAttributes().get("max")).intValue());
+        assertEquals(1, constraintDescriptor.getGroups().size());
+        propertyDescriptor = 
bookBeanDescriptor.getConstraintsForProperty("author");
+        assertEquals(1, propertyDescriptor.getConstraintDescriptors().size());
+        assertTrue(propertyDescriptor.isCascaded());
+        
assertNull(bookBeanDescriptor.getConstraintsForProperty("unconstraintField"));
+    }
+
+    @Test
+    public void testKeyedMetadata() {
+        @SuppressWarnings("serial")
+        BeanDescriptor beanDescriptor = validator.getConstraintsForClass(new 
HashMap<String, Object>() {
+        }.getClass());
+        assertNotNull(beanDescriptor);
+        assertFalse(beanDescriptor.isBeanConstrained());
+        assertNull(beanDescriptor.getConstraintsForProperty("[foo]"));
+    }
+
+    @Test
+    public void testGenericKeyedMetadata() {
+        BeanDescriptor beanDescriptor = 
validator.getConstraintsForClass(Map.class);
+        assertNotNull(beanDescriptor);
+        assertFalse(beanDescriptor.isBeanConstrained());
+        assertNull(beanDescriptor.getConstraintsForProperty("[foo]"));
+    }
+
+    @Test
+    public void testIndexedMetadata() {
+        BeanDescriptor beanDescriptor = 
validator.getConstraintsForClass(Array.newInstance(Author.class, 0).getClass());
+        assertNotNull(beanDescriptor);
+        assertFalse(beanDescriptor.isBeanConstrained());
+        assertNull(beanDescriptor.getConstraintsForProperty("[0]"));
+    }
+
+    @Test
+    public void testGenericIndexedMetadata() {
+        BeanDescriptor beanDescriptor = 
validator.getConstraintsForClass(List.class);
+        assertNotNull(beanDescriptor);
+        assertFalse(beanDescriptor.isBeanConstrained());
+        assertNull(beanDescriptor.getConstraintsForProperty("[0]"));
+    }
+
+    @Test
+    public void testValidateClassImplementingCloneable() {
+        Set<ConstraintViolation<TestCloneableClass>> errors = 
validator.validate(new TestCloneableClass());
+        assertTrue(errors.isEmpty());
+    }
+
+    @Test
+    public void testValidatePrimitiveBooleanPropertyNameIssue149() {
+        Set<ConstraintViolation<Issue149Subject>> violations = 
validator.validate(new Issue149Subject());
+        assertEquals(1, violations.size());
+        ConstraintViolation<Issue149Subject> violation = 
violations.iterator().next();
+        assertEquals("false", violation.getMessage());
+        assertEquals("booleanFalse", violation.getPropertyPath().toString());
+    }
+
+    public static class Issue149Subject {
+        @AssertTrue(message = "true")
+        public boolean isBooleanTrue() {
+            return true;
+        }
+
+        @AssertTrue(message = "false")
+        public boolean isBooleanFalse() {
+            return false;
+        }
+    }
+
+    private static class TestCloneableClass implements Cloneable {
+    }
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidationTestBase.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidationTestBase.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidationTestBase.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidationTestBase.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,58 @@
+/*
+ * 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.jsr;
+
+import java.util.Locale;
+
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+public abstract class ValidationTestBase {
+    protected static ValidatorFactory factory;
+
+    @BeforeClass
+    public static void setupValidatorFactory() {
+        factory = Validation.buildDefaultValidatorFactory();
+        ((DefaultMessageInterpolator) 
factory.getMessageInterpolator()).setLocale(Locale.ENGLISH);
+    }
+
+    /**
+     * Validator instance to test
+     */
+    protected Validator validator;
+
+    @Before
+    public void setUp() throws Exception {
+        validator = createValidator();
+    }
+
+    /**
+     * Create the validator instance.
+     * 
+     * @return Validator
+     */
+    protected Validator createValidator() {
+        return factory.getValidator();
+    }
+
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidatorResolutionTest.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidatorResolutionTest.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidatorResolutionTest.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/ValidatorResolutionTest.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.bval.jsr;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.validation.Constraint;
+import javax.validation.ConstraintDefinitionException;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.Payload;
+import javax.validation.constraints.NotNull;
+
+import org.junit.Test;
+
+/**
+ * Checks the correct behavior of the validator resolution algorithm.
+ * 
+ * @author Carlos Vara
+ */
+public class ValidatorResolutionTest extends ValidationTestBase {
+
+    /**
+     * Check that a {@link ConstraintDefinitionException} is thrown when the
+     * only available validator is associated with a different annotation type.
+     */
+    @Test(expected = ConstraintDefinitionException.class)
+    public void testInvalidValidator() {
+        validator.validate(new Person());
+    }
+
+    public static class Person {
+        @PersonName
+        public String name;
+    }
+
+    @Constraint(validatedBy = { InvalidPersonNameValidator.class })
+    @Documented
+    @Target({ METHOD, FIELD, TYPE })
+    @Retention(RUNTIME)
+    public static @interface PersonName {
+        String message() default "Wrong person name";
+
+        Class<?>[] groups() default {};
+
+        Class<? extends Payload>[] payload() default {};
+    }
+
+    public static class InvalidPersonNameValidator implements 
ConstraintValidator<NotNull, String> {
+        @Override
+        public void initialize(NotNull constraintAnnotation) {
+            // Nothing
+        }
+
+        @Override
+        public boolean isValid(String value, ConstraintValidatorContext 
context) {
+            return true;
+        }
+    }
+
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/AccessTestBusinessObject.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/AccessTestBusinessObject.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/AccessTestBusinessObject.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/AccessTestBusinessObject.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.jsr.example;
+
+import org.apache.bval.constraints.HasValue;
+
+import javax.validation.Valid;
+
+/**
+ * Description: <br/>
+ */
+public class AccessTestBusinessObject {
+    // test that field-access is used, not method-access 
+    @HasValue({ "1", "3" })
+    protected String var1;
+
+    // test that field-access is used, not method-access
+    @Valid
+    private AccessTestBusinessObject next;
+
+    // not annotated with @Valid, not validated!!
+    private AccessTestBusinessObject toBeIgnored;
+    private AccessTestBusinessObject _next;
+
+    public AccessTestBusinessObject(String var1) {
+        this.var1 = var1;
+    }
+
+    @HasValue("3")
+    public String getVar1() {
+        return "3";
+    }
+
+    public void next(AccessTestBusinessObject next) {
+        this._next = next;
+    }
+
+    public void setNext(AccessTestBusinessObject next) {
+        this.next = next;
+    }
+
+    @Valid
+    public AccessTestBusinessObject getNext() {
+        return _next; // method returns '_next', not the field 'next'
+    }
+
+    public AccessTestBusinessObject getToBeIgnored() {
+        return toBeIgnored;
+    }
+
+    public void setToBeIgnored(AccessTestBusinessObject toBeIgnored) {
+        this.toBeIgnored = toBeIgnored;
+    }
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/AccessTestBusinessObjectSub.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/AccessTestBusinessObjectSub.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/AccessTestBusinessObjectSub.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/AccessTestBusinessObjectSub.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,58 @@
+/*
+ * 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.jsr.example;
+
+import org.apache.bval.constraints.HasValue;
+
+/**
+ * Description: <br/>
+ */
+public class AccessTestBusinessObjectSub extends AccessTestBusinessObject {
+    private String var2, _var2;
+
+    public void setVar2(String var2) {
+        this.var2 = var2;
+    }
+
+    public void setvar2(String _var2) {
+        this._var2 = _var2;
+    }
+
+    public AccessTestBusinessObjectSub(String var1) {
+        super(var1);
+    }
+
+    // getVar1() is called on subclass, although annotated on superclass    
+    @Override
+    public String getVar1() {
+        return var1;
+    }
+
+    //// test that getvar2() is called, not getVar2()
+
+    @HasValue("5")
+    public String getvar2() {
+        return _var2;
+    }
+
+    @HasValue("6")
+    public String getVar2() {
+        return var2;
+    }
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Address.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Address.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Address.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Address.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,101 @@
+/*
+ * 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.jsr.example;
+
+import org.apache.bval.constraints.ZipCodeCityCoherence;
+
+import javax.validation.GroupSequence;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.validation.groups.Default;
+
+@ZipCodeCityCoherence
+public class Address implements ZipCodeCityCarrier {
+    @NotNull
+    @Size(max = 30)
+    private String addressline1;
+    @Size(max = 30)
+    private String addressline2;
+    @Size(max = 11)
+    private String zipCode;
+    @NotNull
+    @Valid
+    private Country country;
+    private String city;
+
+    public String getAddressline1() {
+        return addressline1;
+    }
+
+    public void setAddressline1(String addressline1) {
+        this.addressline1 = addressline1;
+    }
+
+    public String getAddressline2() {
+        return addressline2;
+    }
+
+    public void setAddressline2(String addressline2) {
+        this.addressline2 = addressline2;
+    }
+
+    @Override
+    public String getZipCode() {
+        return zipCode;
+    }
+
+    public void setZipCode(String zipCode) {
+        this.zipCode = zipCode;
+    }
+
+    @Override
+    @Size(max = 30)
+    @NotNull
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public Country getCountry() {
+        return country;
+    }
+
+    public void setCountry(Country country) {
+        this.country = country;
+    }
+
+    /**
+     * Check coherence on the overall object
+     * Needs basic checking to be green first
+     */
+    public interface HighLevelCoherence {
+    }
+
+    /**
+     * Check both basic constraints and high level ones.
+     * High level constraints are not checked if basic constraints fail.
+     */
+    @GroupSequence(value = { Default.class, HighLevelCoherence.class })
+    public interface Complete {
+    }
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Author.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Author.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Author.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Author.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,71 @@
+/*
+ * 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.jsr.example;
+
+import org.apache.bval.constraints.NotEmpty;
+
+import javax.validation.GroupSequence;
+import javax.validation.Valid;
+import javax.validation.constraints.Size;
+import java.util.List;
+
+@GroupSequence({ First.class, Author.class, Last.class })
+public class Author {
+    @NotEmpty(groups = Last.class)
+    private String firstName;
+    @NotEmpty(groups = First.class)
+    private String lastName;
+    @Size(max = 40, groups = First.class)
+    private String company;
+
+    @Valid
+    private List<Address> addresses;
+
+    public List<Address> getAddresses() {
+        return addresses;
+    }
+
+    public void setAddresses(List<Address> addresses) {
+        this.addresses = addresses;
+    }
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getCompany() {
+        return company;
+    }
+
+    public void setCompany(String company) {
+        this.company = company;
+    }
+}
\ No newline at end of file

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Book.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Book.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Book.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Book.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,90 @@
+/*
+ * 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.jsr.example;
+
+import org.apache.bval.constraints.NotEmpty;
+
+import javax.validation.GroupSequence;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+@GroupSequence({ First.class, Second.class, Book.class, Last.class })
+public class Book {
+    @NotNull(groups = First.class)
+    @NotEmpty(groups = First.class)
+    private String title;
+
+    @Size(max = 30, groups = Second.class)
+    private String subtitle;
+
+    @Valid
+    @NotNull(groups = First.class)
+    private Author author;
+
+    @NotNull
+    private int uselessField;
+
+    private int unconstraintField;
+
+    public int getUnconstraintField() {
+        return unconstraintField;
+    }
+
+    public void setUnconstraintField(int unconstraintField) {
+        this.unconstraintField = unconstraintField;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getSubtitle() {
+        return subtitle;
+    }
+
+    public void setSubtitle(String subtitle) {
+        this.subtitle = subtitle;
+    }
+
+    public Author getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(Author author) {
+        this.author = author;
+    }
+
+    @GroupSequence(value = { First.class, Second.class, Last.class })
+    public interface All {
+    }
+
+    /**
+     * a get() without any name blew up with a failure.
+     * See BVAL-157
+     */
+    public int get() {
+        return 42;
+    }
+
+}
\ No newline at end of file

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/BusinessAddress.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/BusinessAddress.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/BusinessAddress.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/BusinessAddress.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,37 @@
+/*
+ * 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.jsr.example;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * Description: <br/>
+ */
+public class BusinessAddress extends Address {
+    private String company;
+
+    @NotNull
+    public String getCompany() {
+        return company;
+    }
+
+    public void setCompany(String company) {
+        this.company = company;
+    }
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/CompanyAddress.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/CompanyAddress.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/CompanyAddress.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/CompanyAddress.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,39 @@
+/*
+ * 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.jsr.example;
+
+import org.apache.bval.constraints.CompanyEmail;
+
+/**
+ * Description: <br/>
+ */
+public class CompanyAddress {
+    @CompanyEmail
+    private String email;
+
+    public CompanyAddress() {
+    }
+
+    public CompanyAddress(String email) {
+        this.email = email;
+    }
+
+    // do not provided getters & setters to test that value access
+    // of combined constraints directly use the private field 'email'
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Continent.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Continent.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Continent.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Continent.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,40 @@
+/*
+ *  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.jsr.example;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A continent has a name and a set of {@link Country}s.
+ * 
+ * @author Carlos Vara
+ */
+public class Continent {
+
+    @NotNull
+    public String name;
+
+    @Valid
+    public Set<Country> countries = new HashSet<Country>();
+
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Country.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Country.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Country.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Country.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,55 @@
+/*
+ * 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.jsr.example;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+public class Country {
+    @NotNull
+    private String name;
+    @Size(max = 2)
+    private String ISO2Code;
+    @Size(max = 3)
+    private String ISO3Code;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getISO2Code() {
+        return ISO2Code;
+    }
+
+    public void setISO2Code(String ISO2Code) {
+        this.ISO2Code = ISO2Code;
+    }
+
+    public String getISO3Code() {
+        return ISO3Code;
+    }
+
+    public void setISO3Code(String ISO3Code) {
+        this.ISO3Code = ISO3Code;
+    }
+}
\ No newline at end of file

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Customer.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Customer.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Customer.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Customer.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,88 @@
+/*
+ * 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.jsr.example;
+
+import org.apache.bval.constraints.Email;
+import org.apache.bval.constraints.Password;
+
+import javax.validation.constraints.NotNull;
+
+public class Customer implements Person {
+    private String firstName;
+    private String middleName;
+    private String lastName;
+    @NotNull
+    private String customerId;
+    @Password(robustness = 5)
+    private String password;
+
+    @Email
+    private String emailAddress;
+
+    public String getEmailAddress() {
+        return emailAddress;
+    }
+
+    public void setEmailAddress(String emailAddress) {
+        this.emailAddress = emailAddress;
+    }
+
+    @Override
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    @Override
+    public String getMiddleName() {
+        return middleName;
+    }
+
+    public void setMiddleName(String middleName) {
+        this.middleName = middleName;
+    }
+
+    @Override
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getCustomerId() {
+        return customerId;
+    }
+
+    public void setCustomerId(String customerId) {
+        this.customerId = customerId;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}
\ No newline at end of file

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Employee.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Employee.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Employee.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Employee.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.jsr.example;
+
+/**
+ * Description: <br/>
+ */
+public class Employee implements Person {
+    private String firstName, lastName;
+
+    public Employee(String firstN, String lastN) {
+        this.firstName = firstN;
+        this.lastName = lastN;
+    }
+
+    @Override
+    public String getFirstName() {
+        return firstName;
+    }
+
+    @Override
+    public String getMiddleName() {
+        return null; // not supported
+    }
+
+    @Override
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Engine.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Engine.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Engine.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Engine.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,31 @@
+/*
+ * 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.jsr.example;
+
+import javax.validation.constraints.Pattern;
+
+public class Engine {
+    // TODO See about Windows bug with container @ Field#getAnnotatedType()
+//    @Pattern.List({
+        @Pattern(regexp = "^[A-Z0-9-]+$", flags = 
Pattern.Flag.CASE_INSENSITIVE, message = "must contain alphabetical characters 
only")//,
+        @Pattern(regexp = "^....-....-....$", message = "must match 
....-....-....")
+//        })
+    public String serialNumber;
+
+}
\ No newline at end of file

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/First.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/First.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/First.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/First.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,25 @@
+/*
+ * 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.jsr.example;
+
+/**
+ * Description: <br/>
+ */
+public interface First {
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/FrenchAddress.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/FrenchAddress.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/FrenchAddress.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/FrenchAddress.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,56 @@
+/*
+ * 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.jsr.example;
+
+import org.apache.bval.constraints.FrenchZipCode;
+
+/**
+ * Description: <br/>
+ */
+public class FrenchAddress {
+    @FrenchZipCode(size = 7)
+    String zipCode;
+
+    @FrenchZipCode
+    String zipCode2 = "123456";
+
+    public FrenchAddress() {
+    }
+
+    public FrenchAddress(String zipCode) {
+        this.zipCode = zipCode;
+    }
+
+    public String getZipCode() {
+        return zipCode;
+    }
+
+    public void setZipCode(String zipCode) {
+        this.zipCode = zipCode;
+    }
+
+    public String getZipCode2() {
+        return zipCode2;
+    }
+
+    public void setZipCode2(String zipCode2) {
+        this.zipCode2 = zipCode2;
+    }
+
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/IllustratedBook.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/IllustratedBook.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/IllustratedBook.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/IllustratedBook.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.jsr.example;
+
+/**
+ * Add a non-cascaded bean to a book.
+ * 
+ * @version $Rev: 1004764 $ $Date: 2010-10-05 13:35:42 -0500 (Tue, 05 Oct 
2010) $
+ */
+public class IllustratedBook extends Book {
+    private Person illustrator;
+
+    /**
+     * @return the illustrator
+     */
+    public Person getIllustrator() {
+        return illustrator;
+    }
+
+    /**
+     * @param illustrator
+     *            the illustrator to set
+     */
+    public void setIllustrator(Person illustrator) {
+        this.illustrator = illustrator;
+    }
+}

Added: 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Last.java
URL: 
http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Last.java?rev=1843674&view=auto
==============================================================================
--- 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Last.java
 (added)
+++ 
tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/example/Last.java
 Fri Oct 12 15:00:48 2018
@@ -0,0 +1,25 @@
+/*
+ * 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.jsr.example;
+
+/**
+ * Description: <br/>
+ */
+public interface Last {
+}


Reply via email to