tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From radcor...@apache.org
Subject svn commit: r1843674 [21/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/...
Date Fri, 12 Oct 2018 15:00:51 GMT
Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/implicit/ImplicitGroupingTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/implicit/ImplicitGroupingTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/implicit/ImplicitGroupingTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/implicit/ImplicitGroupingTest.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.jsr.groups.implicit;
+
+import junit.framework.TestCase;
+import org.apache.bval.jsr.ApacheValidatorFactory;
+import org.apache.bval.jsr.util.TestUtils;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import java.util.Set;
+
+/**
+ * Description: test spec chapter 3.4.4. Implicit grouping<br/>
+ */
+public class ImplicitGroupingTest extends TestCase {
+    private Validator validator;
+
+    @Override
+    protected void setUp() {
+        validator = ApacheValidatorFactory.getDefault().getValidator();
+    }
+
+    public void testValidateImplicitGrouping() {
+        Order order = new Order();
+        // When an Order object is validated on the Default group, ...
+        Set<ConstraintViolation<Order>> violations = validator.validate(order);
+        assertNotNull(TestUtils.getViolation(violations, "creationDate"));
+        assertNotNull(TestUtils.getViolation(violations, "lastUpdate"));
+        assertNotNull(TestUtils.getViolation(violations, "lastModifier"));
+        assertNotNull(TestUtils.getViolation(violations, "lastReader"));
+        assertNotNull(TestUtils.getViolation(violations, "orderNumber"));
+        assertEquals(5, violations.size());
+
+        // When an Order object is validated on the Auditable group, ...
+
+        /* Only the constraints present on Auditable (and any of its super interfaces)
+           and belonging to the Default group are validated
+           when the group Auditable is requested. */
+        violations = validator.validate(order, Auditable.class);
+        assertEquals("Implicit grouping not correctly implemented", 4, violations.size());
+        assertNotNull(TestUtils.getViolation(violations, "creationDate"));
+        assertNotNull(TestUtils.getViolation(violations, "lastUpdate"));
+        assertNotNull(TestUtils.getViolation(violations, "lastModifier"));
+        assertNotNull(TestUtils.getViolation(violations, "lastReader"));
+    }
+}

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/implicit/Order.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/implicit/Order.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/implicit/Order.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/implicit/Order.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,80 @@
+/*
+ * 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.groups.implicit;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+/**
+ * Represents an order in the system
+ */
+public class Order implements Auditable {
+    private String creationDate;
+    private String lastUpdate;
+    private String lastModifier;
+    private String lastReader;
+
+    private String orderNumber;
+
+    @Override
+    public String getCreationDate() {
+        return this.creationDate;
+    }
+
+    @Override
+    public String getLastUpdate() {
+        return this.lastUpdate;
+    }
+
+    @Override
+    public String getLastModifier() {
+        return this.lastModifier;
+    }
+
+    @Override
+    public String getLastReader() {
+        return this.lastReader;
+    }
+
+    @NotNull
+    @Size(min = 10, max = 10)
+    public String getOrderNumber() {
+        return this.orderNumber;
+    }
+
+    public void setCreationDate(String creationDate) {
+        this.creationDate = creationDate;
+    }
+
+    public void setLastUpdate(String lastUpdate) {
+        this.lastUpdate = lastUpdate;
+    }
+
+    public void setLastModifier(String lastModifier) {
+        this.lastModifier = lastModifier;
+    }
+
+    public void setLastReader(String lastReader) {
+        this.lastReader = lastReader;
+    }
+
+    public void setOrderNumber(String orderNumber) {
+        this.orderNumber = orderNumber;
+    }
+}
\ No newline at end of file

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/BillableUser.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/BillableUser.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/BillableUser.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/BillableUser.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.jsr.groups.inheritance;
+
+import org.apache.bval.jsr.groups.Billable;
+import org.apache.bval.jsr.groups.BillableCreditCard;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.groups.Default;
+
+/**
+ * Description: <br/>
+ */
+public class BillableUser {
+    @NotNull
+    private String firstname;
+
+    @NotNull(groups = Default.class)
+    private String lastname;
+
+    @NotNull(groups = { Billable.class })
+    private BillableCreditCard defaultCreditCard;
+
+    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 BillableCreditCard getDefaultCreditCard() {
+        return defaultCreditCard;
+    }
+
+    public void setDefaultCreditCard(BillableCreditCard defaultCreditCard) {
+        this.defaultCreditCard = defaultCreditCard;
+    }
+}
\ No newline at end of file

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/BuyInOneClick.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/BuyInOneClick.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/BuyInOneClick.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/BuyInOneClick.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,30 @@
+/*
+ * 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.groups.inheritance;
+
+import org.apache.bval.jsr.groups.Billable;
+
+import javax.validation.groups.Default;
+
+/**
+ * Customer can buy without harrassing checking process.
+ * spec: Example 3.3. Groups can inherit other groups
+ */
+public interface BuyInOneClick extends Default, Billable {
+}

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/GroupInheritanceTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/GroupInheritanceTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/GroupInheritanceTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/inheritance/GroupInheritanceTest.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.groups.inheritance;
+
+import junit.framework.TestCase;
+import org.apache.bval.jsr.ApacheValidatorFactory;
+import org.apache.bval.jsr.util.TestUtils;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import java.util.Set;
+
+/**
+ * Description: <br/>
+ */
+public class GroupInheritanceTest extends TestCase {
+    private Validator validator;
+
+    @Override
+    protected void setUp() {
+        validator = ApacheValidatorFactory.getDefault().getValidator();
+    }
+
+    /**
+     * validating the group BuyInOneClick will lead to the following constraints checking:
+     *<pre>
+     *  * @NotNull on firstname and lastname
+     *  * @NotNull on defaultCreditCard</pre>
+     * because Default and Billable are superinterfaces of BuyInOneClick.
+     */
+    public void testValidGroupBuyInOneClick() {
+        BillableUser user = new BillableUser();
+
+        Set<ConstraintViolation<BillableUser>> violations = validator.validate(user, BuyInOneClick.class);
+        assertEquals(3, violations.size());
+        assertNotNull(TestUtils.getViolation(violations, "firstname"));
+        assertNotNull(TestUtils.getViolation(violations, "lastname"));
+        assertNotNull(TestUtils.getViolation(violations, "defaultCreditCard"));
+    }
+}

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/Address.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/Address.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/Address.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/Address.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,87 @@
+/*
+ * 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.groups.redefining;
+
+import org.apache.bval.constraints.ZipCodeCityCoherence;
+import org.apache.bval.jsr.example.ZipCodeCityCarrier;
+
+import javax.validation.GroupSequence;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+/**
+ * Example 3.6. Redefining Default group for Address:
+ * To redefine Default for a class, place a @GroupSequence annotation on the class ; 
+ * this sequence expresses the sequence of groups that does
+ * substitute Default for this class.
+ */
+@GroupSequence({ Address.class, Address.HighLevelCoherence.class, Address.ExtraCareful.class })
+@ZipCodeCityCoherence(groups = Address.HighLevelCoherence.class)
+public class Address implements ZipCodeCityCarrier {
+
+    /**
+     * check coherence on the overall object
+     * Needs basic checking to be green first
+     */
+    public interface HighLevelCoherence {
+    }
+
+    /**
+     * Extra-careful validation group.
+     */
+    public interface ExtraCareful {
+    }
+
+    @NotNull
+    @Size(max = 50, min = 1, groups = ExtraCareful.class)
+    private String street1;
+
+    @NotNull
+    private String zipCode;
+
+    @NotNull
+    @Size(max = 30)
+    private String city;
+
+    public String getStreet1() {
+        return street1;
+    }
+
+    public void setStreet1(String street1) {
+        this.street1 = street1;
+    }
+
+    @Override
+    public String getZipCode() {
+        return zipCode;
+    }
+
+    public void setZipCode(String zipCode) {
+        this.zipCode = zipCode;
+    }
+
+    @Override
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+}
\ No newline at end of file

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/InvalidRedefinedDefaultGroupAddress.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/InvalidRedefinedDefaultGroupAddress.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/InvalidRedefinedDefaultGroupAddress.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/InvalidRedefinedDefaultGroupAddress.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,44 @@
+/*
+ * 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.groups.redefining;
+
+import javax.validation.GroupSequence;
+import javax.validation.constraints.NotNull;
+
+/**
+ * If a @GroupSequence redefining the Default group for a class A does not
+ * contain the group A, a GroupDefinitionException is raised when the class is
+ * validated or when its metadata is requested.
+ */
+@GroupSequence({ Address.class, Address.HighLevelCoherence.class })
+public class InvalidRedefinedDefaultGroupAddress {
+    @NotNull(groups = Address.HighLevelCoherence.class)
+    private String street;
+
+    @NotNull
+    private String city;
+
+    /**
+     * check coherence on the overall object
+     * Needs basic checking to be green first
+     */
+    public interface HighLevelCoherence {
+    }
+
+}

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/RedefiningDefaultGroupTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/RedefiningDefaultGroupTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/RedefiningDefaultGroupTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/RedefiningDefaultGroupTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,97 @@
+/*
+ * 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.groups.redefining;
+
+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.GroupDefinitionException;
+
+import org.apache.bval.jsr.ValidationTestBase;
+import org.apache.bval.jsr.util.TestUtils;
+import org.junit.Test;
+
+/**
+ * Description: test Redefining the Default group for a class (spec. chapter 3.4.3)<br/>
+ */
+public class RedefiningDefaultGroupTest extends ValidationTestBase {
+
+    /**
+     * when an address object is validated for the group Default,
+     * all constraints belonging to the group Default and hosted on Address are evaluated
+     */
+    @Test
+    public void testValidateDefaultGroup() {
+        Address address = new Address();
+        Set<ConstraintViolation<Address>> violations = validator.validate(address);
+        assertEquals(3, violations.size());
+        assertNotNull(TestUtils.getViolation(violations, "street1"));
+        assertNotNull(TestUtils.getViolation(violations, "zipCode"));
+        assertNotNull(TestUtils.getViolation(violations, "city"));
+
+        address.setStreet1("Elmstreet");
+        address.setZipCode("1234");
+        address.setCity("Gotham City");
+        violations = validator.validate(address);
+        assertTrue(violations.isEmpty());
+
+        violations = validator.validate(address, Address.HighLevelCoherence.class);
+        assertTrue(violations.isEmpty());
+
+        address.setCity("error");
+        violations = validator.validate(address, Address.HighLevelCoherence.class);
+        assertEquals(1, violations.size());
+
+        /**
+         * If none fails, all HighLevelCoherence constraints present on Address are evaluated.
+         *
+         * In other words, when validating the Default group for Address,
+         * the group sequence defined on the Address class is used.
+         */
+        violations = validator.validate(address);
+        assertEquals("redefined default group for Address must also validate HighLevelCoherence", 1, violations.size());
+    }
+
+    @Test
+    public void testValidateProperty() {
+        Address address = new Address();
+        address.setStreet1("");
+        Set<ConstraintViolation<Address>> violations = validator.validateProperty(address, "street1");
+        //prove that ExtraCareful group was validated:
+        assertEquals(1, violations.size());
+        assertNotNull(TestUtils.getViolation(violations, "street1"));
+    }
+
+    @Test
+    public void testValidateValue() {
+        Set<ConstraintViolation<Address>> violations = validator.validateValue(Address.class, "street1", "");
+        //prove that ExtraCareful group was validated:
+        assertEquals(1, violations.size());
+        assertNotNull(TestUtils.getViolation(violations, "street1"));
+    }
+
+    @Test(expected = GroupDefinitionException.class)
+    public void testRaiseGroupDefinitionException() {
+        validator.validate(new InvalidRedefinedDefaultGroupAddress());
+    }
+}

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/metadata/ContainerElementKeyTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/metadata/ContainerElementKeyTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/metadata/ContainerElementKeyTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/metadata/ContainerElementKeyTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,118 @@
+/*
+ * 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.metadata;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.TypeVariable;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ContainerElementKeyTest {
+    public static abstract class HasList {
+        public List<String> strings;
+    }
+
+    public static abstract class BoundListType implements List<String> {
+    }
+
+    private Field stringsField;
+
+    @Before
+    public void setup() throws Exception {
+        stringsField = HasList.class.getField("strings");
+    }
+
+    @Test
+    public void testBasic() {
+        final ContainerElementKey containerElementKey =
+            new ContainerElementKey(stringsField.getAnnotatedType(), Integer.valueOf(0));
+
+        assertEquals(List.class, containerElementKey.getContainerClass());
+        assertEquals(0, containerElementKey.getTypeArgumentIndex().intValue());
+        assertEquals(String.class, containerElementKey.getAnnotatedType().getType());
+    }
+
+    @Test
+    public void testAssignableKeys() {
+        final ContainerElementKey containerElementKey =
+            new ContainerElementKey(stringsField.getAnnotatedType(), Integer.valueOf(0));
+
+        final Iterator<ContainerElementKey> iterator = containerElementKey.getAssignableKeys().iterator();
+        {
+            assertTrue(iterator.hasNext());
+            final ContainerElementKey assignableKey = iterator.next();
+            assertEquals(Collection.class, assignableKey.getContainerClass());
+            assertEquals(0, assignableKey.getTypeArgumentIndex().intValue());
+            assertTrue(assignableKey.getAnnotatedType().getType() instanceof TypeVariable<?>);
+        }
+        {
+            assertTrue(iterator.hasNext());
+            final ContainerElementKey assignableKey = iterator.next();
+            assertEquals(Iterable.class, assignableKey.getContainerClass());
+            assertEquals(0, assignableKey.getTypeArgumentIndex().intValue());
+            assertTrue(assignableKey.getAnnotatedType().getType() instanceof TypeVariable<?>);
+        }
+        assertFalse(iterator.hasNext());
+    }
+
+    @Test
+    public void testAssignableKeysWithExplicitBinding() {
+        final ContainerElementKey containerElementKey = new ContainerElementKey(BoundListType.class, null);
+
+        final Iterator<ContainerElementKey> iterator = containerElementKey.getAssignableKeys().iterator();
+        {
+            assertTrue(iterator.hasNext());
+            final ContainerElementKey assignableKey = iterator.next();
+            assertEquals(List.class, assignableKey.getContainerClass());
+            assertEquals(0, assignableKey.getTypeArgumentIndex().intValue());
+        }
+        {
+            assertTrue(iterator.hasNext());
+            final ContainerElementKey assignableKey = iterator.next();
+            assertEquals(Collection.class, assignableKey.getContainerClass());
+            assertEquals(0, assignableKey.getTypeArgumentIndex().intValue());
+        }
+        {
+            assertTrue(iterator.hasNext());
+            final ContainerElementKey assignableKey = iterator.next();
+            assertEquals(Iterable.class, assignableKey.getContainerClass());
+            assertEquals(0, assignableKey.getTypeArgumentIndex().intValue());
+            assertTrue(assignableKey.getAnnotatedType().getType() instanceof TypeVariable<?>);
+        }
+        assertFalse(iterator.hasNext());
+    }
+
+    @Test
+    public void testTypeVariableInheritance() {
+        final ContainerElementKey containerElementKey =
+            new ContainerElementKey(stringsField.getAnnotatedType(), Integer.valueOf(0));
+
+        assertTrue(containerElementKey.represents(List.class.getTypeParameters()[0]));
+        assertTrue(containerElementKey.represents(Collection.class.getTypeParameters()[0]));
+        assertTrue(containerElementKey.represents(Iterable.class.getTypeParameters()[0]));
+    }
+}

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/util/PathImplTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/util/PathImplTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/util/PathImplTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/util/PathImplTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,201 @@
+/*
+ * 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.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Iterator;
+
+import javax.validation.Path;
+import javax.validation.ValidationException;
+
+import org.junit.Test;
+
+/**
+ * PathImpl Tester.
+ *
+ * @version 1.0
+ * @since <pre>10/01/2009</pre>
+ */
+public class PathImplTest {
+    @Test
+    public void testParsing() {
+        String property = "order[3].deliveryAddress.addressline[1]";
+        Path path = PathImpl.createPathFromString(property);
+        assertEquals(property, path.toString());
+
+        Iterator<Path.Node> propIter = path.iterator();
+
+        assertTrue(propIter.hasNext());
+        Path.Node elem = propIter.next();
+        assertFalse(elem.isInIterable());
+        assertEquals("order", elem.getName());
+
+        assertTrue(propIter.hasNext());
+        elem = propIter.next();
+        assertTrue(elem.isInIterable());
+        assertEquals(new Integer(3), elem.getIndex());
+        assertEquals("deliveryAddress", elem.getName());
+
+        assertTrue(propIter.hasNext());
+        elem = propIter.next();
+        assertFalse(elem.isInIterable());
+        assertEquals(null, elem.getIndex());
+        assertEquals("addressline", elem.getName());
+
+        assertTrue(propIter.hasNext());
+        elem = propIter.next();
+        assertTrue(elem.isInIterable());
+        assertEquals(new Integer(1), elem.getIndex());
+        assertNull(elem.getName());
+
+        assertFalse(propIter.hasNext());
+    }
+
+    @Test
+    public void testParseMapBasedProperty() {
+        String property = "order[foo].deliveryAddress";
+        Path path = PathImpl.createPathFromString(property);
+        Iterator<Path.Node> propIter = path.iterator();
+
+        assertTrue(propIter.hasNext());
+        Path.Node elem = propIter.next();
+        assertFalse(elem.isInIterable());
+        assertEquals("order", elem.getName());
+
+        assertTrue(propIter.hasNext());
+        elem = propIter.next();
+        assertTrue(elem.isInIterable());
+        assertEquals("foo", elem.getKey());
+        assertEquals("deliveryAddress", elem.getName());
+
+        assertFalse(propIter.hasNext());
+    }
+
+    //some of the examples from the 1.0 bean validation spec, section 4.2
+    @Test
+    public void testSpecExamples() {
+        String fourthAuthor = "authors[3]";
+        Path path = PathImpl.createPathFromString(fourthAuthor);
+        Iterator<Path.Node> propIter = path.iterator();
+
+        assertTrue(propIter.hasNext());
+        Path.Node elem = propIter.next();
+        assertFalse(elem.isInIterable());
+        assertEquals("authors", elem.getName());
+
+        assertTrue(propIter.hasNext());
+        elem = propIter.next();
+        assertTrue(elem.isInIterable());
+        assertEquals(3, elem.getIndex().intValue());
+        assertNull(elem.getName());
+        assertFalse(propIter.hasNext());
+
+        String firstAuthorCompany = "authors[0].company";
+        path = PathImpl.createPathFromString(firstAuthorCompany);
+        propIter = path.iterator();
+
+        assertTrue(propIter.hasNext());
+        elem = propIter.next();
+        assertFalse(elem.isInIterable());
+        assertEquals("authors", elem.getName());
+
+        assertTrue(propIter.hasNext());
+        elem = propIter.next();
+        assertTrue(elem.isInIterable());
+        assertEquals(0, elem.getIndex().intValue());
+        assertEquals("company", elem.getName());
+        assertFalse(propIter.hasNext());
+    }
+
+    @Test
+    public void testNull() {
+        assertEquals(PathImpl.createPathFromString(null), PathImpl.create());
+
+        assertEquals("", PathImpl.create().toString());
+        Path path = PathImpl.create();
+        Path.Node node = path.iterator().next();
+        assertEquals(null, node.getName());
+    }
+
+    @Test(expected = ValidationException.class)
+    public void testUnbalancedBraces() {
+        PathImpl.createPathFromString("foo[.bar");
+    }
+
+    @Test(expected = ValidationException.class)
+    public void testIndexInMiddleOfProperty() {
+        PathImpl.createPathFromString("f[1]oo.bar");
+    }
+
+    @Test(expected = ValidationException.class)
+    public void testTrailingPathSeparator() {
+        PathImpl.createPathFromString("foo.bar.");
+    }
+
+    @Test(expected = ValidationException.class)
+    public void testLeadingPathSeparator() {
+        PathImpl.createPathFromString(".foo.bar");
+    }
+
+    @Test
+    public void testEmptyString() {
+        Path path = PathImpl.createPathFromString("");
+        assertEquals(null, path.iterator().next().getName());
+    }
+
+    @Test
+    public void testToString() {
+        PathImpl path = PathImpl.create();
+        path.addNode(new NodeImpl.PropertyNodeImpl("firstName"));
+        assertEquals("firstName", path.toString());
+
+        path = PathImpl.create();
+        path.getLeafNode().setIndex(2);
+        assertEquals("[2]", path.toString());
+        path.addNode(new NodeImpl.PropertyNodeImpl("firstName"));
+        assertEquals("[2].firstName", path.toString());
+    }
+
+    @Test
+    public void testAddRemoveNodes() {
+        PathImpl path = PathImpl.createPathFromString("");
+        assertTrue(path.isRootPath());
+        assertEquals(1, countNodes(path));
+        path.addNode(new NodeImpl.PropertyNodeImpl("foo"));
+        assertFalse(path.isRootPath());
+        assertEquals(1, countNodes(path));
+        path.removeLeafNode();
+        assertTrue(path.isRootPath());
+        assertEquals(1, countNodes(path));
+    }
+
+    private int countNodes(Path path) {
+        int result = 0;
+        for (Iterator<Path.Node> iter = path.iterator(); iter.hasNext();) {
+            iter.next();
+            result++;
+        }
+        return result;
+    }
+
+}

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/util/TestUtils.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/util/TestUtils.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/util/TestUtils.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/util/TestUtils.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,118 @@
+/*
+ * 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.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.inject.Vetoed;
+import javax.validation.ConstraintViolation;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.metadata.ElementDescriptor.ConstraintFinder;
+
+/**
+ * Description: <br/>
+ */
+public class TestUtils {
+    /**
+     * @param violations
+     * @param propertyPath
+     *            - string format of a propertyPath
+     * @return the constraintViolation with the propertyPath's string
+     *         representation given
+     */
+    public static <T> ConstraintViolation<T> getViolation(Set<ConstraintViolation<T>> violations, String propertyPath) {
+        for (ConstraintViolation<T> each : violations) {
+            if (each.getPropertyPath().toString().equals(propertyPath)) {
+                return each;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * @param violations
+     * @param propertyPath
+     * @return count of violations
+     */
+    public static <T> int countViolations(Set<ConstraintViolation<T>> violations, String propertyPath) {
+        int result = 0;
+        for (ConstraintViolation<T> each : violations) {
+            if (each.getPropertyPath().toString().equals(propertyPath)) {
+                result++;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * @param <T>
+     * @param violations
+     * @param message
+     * @return the constraint violation with the specified message found, if any
+     */
+    public static <T> ConstraintViolation<T> getViolationWithMessage(Set<ConstraintViolation<T>> violations,
+        String message) {
+        for (ConstraintViolation<T> each : violations) {
+            if (each.getMessage().equals(message)) {
+                return each;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * assume set addition either does nothing, returning false per collection
+     * contract, or throws an Exception; in either case size should remain
+     * unchanged
+     * 
+     * @param collection
+     */
+    public static void failOnModifiable(Collection<?> collection, String description) {
+        int size = collection.size();
+        try {
+            assertFalse(String.format("should not permit modification to %s", description), collection.add(null));
+        } catch (Exception e) {
+            // okay
+        }
+        assertEquals("constraint descriptor set size changed", size, collection.size());
+    }
+
+    /**
+     * Assert that the specified ConstraintFinder provides constraints of each of the specified types.
+     * @param constraintFinder
+     * @param types
+     */
+    public static void assertConstraintTypesFound(ConstraintFinder constraintFinder,
+        Class<? extends Annotation>... types) {
+        outer: for (Class<? extends Annotation> type : types) {
+            for (ConstraintDescriptor<?> descriptor : constraintFinder.getConstraintDescriptors()) {
+                if (descriptor.getAnnotation().annotationType().equals(type)) {
+                    continue outer;
+                }
+            }
+            fail(String.format("Missing expected constraint descriptor of type %s", type));
+        }
+    }
+}

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/xml/Demo.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/xml/Demo.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/xml/Demo.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/xml/Demo.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.xml;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.UnmarshallerHandler;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.junit.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+public class Demo {
+
+    @Test
+    public void test1() throws Exception {
+        JAXBContext jc = JAXBContext.newInstance(ObjectFactory.class);
+
+        // Set the parent XMLReader on the XMLFilter
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        SAXParser sp = spf.newSAXParser();
+        XMLReader xr = sp.getXMLReader();
+
+        // Set UnmarshallerHandler as ContentHandler on XMLFilter
+        
+        Unmarshaller unmarshaller = jc.createUnmarshaller();
+        
+        UnmarshallerHandler unmarshallerHandler = unmarshaller.getUnmarshallerHandler();
+        xr.setContentHandler(unmarshallerHandler);
+
+        // Parse the XML
+        InputSource xml = new InputSource(getClass().getResourceAsStream("/sample-validation2.xml"));
+        xr.parse(xml);
+        JAXBElement<ValidationConfigType> result = (JAXBElement<ValidationConfigType>) unmarshallerHandler.getResult();
+        System.out.println(result.getValue());
+    }
+}

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

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

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/xml/ValidationParserTest.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/xml/ValidationParserTest.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/xml/ValidationParserTest.java (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/java/org/apache/bval/jsr/xml/ValidationParserTest.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,132 @@
+/*
+ * 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.xml;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.ValidationException;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.apache.bval.jsr.ApacheValidationProvider;
+import org.apache.bval.jsr.ApacheValidatorConfiguration;
+import org.apache.bval.jsr.ConfigurationImpl;
+import org.apache.bval.jsr.example.XmlEntitySampleBean;
+import org.apache.bval.jsr.resolver.SimpleTraversableResolver;
+import org.apache.bval.util.reflection.Reflection;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+/**
+ * ValidationParser Tester.
+ *
+ * @author <Authors name>
+ * @version 1.0
+ * @since <pre>11/25/2009</pre>
+ */
+public class ValidationParserTest implements ApacheValidatorConfiguration.Properties {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    @Test
+    public void testGetInputStream() throws IOException {
+        assertNotNull(ValidationParser.getInputStream("sample-validation.xml"));
+
+        // make sure there are duplicate resources on the classpath before the next checks:
+        final Enumeration<URL> resources =
+            Reflection.getClassLoader(ValidationParser.class).getResources("META-INF/MANIFEST.MF");
+
+        assumeTrue(resources.hasMoreElements());
+        resources.nextElement();
+        assumeTrue(resources.hasMoreElements());
+    }
+
+    @Test
+    public void testGetNonUniqueInputStream() throws IOException {
+        thrown.expect(ValidationException.class);
+        thrown.expectMessage("More than ");
+        ValidationParser.getInputStream("META-INF/MANIFEST.MF"); // this is available in multiple jars hopefully
+    }
+
+    @Test
+    public void testParse() {
+        ConfigurationImpl config = new ConfigurationImpl(null, new ApacheValidationProvider());
+        ValidationParser.processValidationConfig("sample-validation.xml", config);
+    }
+
+    @Test
+    public void testParseV11() {
+        ConfigurationImpl config = new ConfigurationImpl(null, new ApacheValidationProvider());
+        ValidationParser.processValidationConfig("sample-validation11.xml", config);
+    }
+
+    @Test
+    public void testParseV20() {
+        ConfigurationImpl config = new ConfigurationImpl(null, new ApacheValidationProvider());
+        ValidationParser.processValidationConfig("sample-validation2.xml", config);
+    }
+
+    @Test
+    public void testConfigureFromXml() {
+        ValidatorFactory factory = getFactory();
+        assertThat(factory.getMessageInterpolator(), instanceOf(TestMessageInterpolator.class));
+        assertThat(factory.getConstraintValidatorFactory(), instanceOf(TestConstraintValidatorFactory.class));
+        assertThat(factory.getTraversableResolver(), instanceOf(SimpleTraversableResolver.class));
+        assertNotNull(factory.getValidator());
+    }
+
+    private ValidatorFactory getFactory() {
+        ApacheValidatorConfiguration config = Validation.byProvider(ApacheValidationProvider.class).configure();
+        config.addProperty(VALIDATION_XML_PATH, "sample-validation.xml");
+        return config.buildValidatorFactory();
+    }
+
+    @Test
+    public void testXmlEntitySample() {
+        XmlEntitySampleBean bean = new XmlEntitySampleBean();
+        bean.setFirstName("tooooooooooooooooooooooooooo long");
+        bean.setValueCode("illegal");
+        Validator validator = getFactory().getValidator();
+        Set<ConstraintViolation<XmlEntitySampleBean>> results = validator.validate(bean);
+        assertFalse(results.isEmpty());
+        assertEquals(3, results.size());
+
+        bean.setZipCode("123");
+        bean.setValueCode("20");
+        bean.setFirstName("valid");
+        results = validator.validate(bean);
+        assertTrue(results.isEmpty());
+    }
+
+}

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/resources/ValidationMessages.properties
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/resources/ValidationMessages.properties?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/resources/ValidationMessages.properties (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/resources/ValidationMessages.properties Fri Oct 12 15:00:48 2018
@@ -0,0 +1,26 @@
+# 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.
+
+# standard messages
+javax.validation.constraints.Pattern.message=must match "{regexp}"
+
+# custom messages (examples) for validation-api-1.0.Beta4
+test.validator.creditcard=credit card is not valid
+
+# custom messages (examples) for validation-api-1.0.CR1
+validator.creditcard=credit card is not valid
+

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/resources/java.policy
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/resources/java.policy?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/resources/java.policy (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/resources/java.policy Fri Oct 12 15:00:48 2018
@@ -0,0 +1,94 @@
+// 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.
+//
+// Allows unit tests to run with a Java Security Manager
+//
+
+grant
+{
+  // let everyone read target dir
+  permission java.io.FilePermission "${project.build.directory}${/}-", "read";
+};
+
+// we don't care about the permissions of the testing infrastructure,
+// including maven;
+grant codeBase "file://${user.home}/.m2/repository/org/apache/maven/-"
+{
+  permission java.security.AllPermission;
+};
+
+// junit;
+grant codeBase "file://${user.home}/.m2/repository/junit/-"
+{
+  permission java.security.AllPermission;
+};
+
+// mockito;
+grant codeBase "file://${user.home}/.m2/repository/org/mockito/-"
+{
+  permission java.security.AllPermission;
+};
+
+// objenesis (via mockito);
+grant codeBase "file://${user.home}/.m2/repository/org/objenesis/-"
+{
+  permission java.security.AllPermission;
+};
+
+// jaxb impl
+grant codeBase "file://${user.home}/.m2/repository/com/sun/xml/bind/jaxb-impl/-"
+{
+  permission java.security.AllPermission;
+};
+
+// Geronimo specs
+grant codeBase "file://${user.home}/.m2/repository/org/apache/geronimo/specs/-"
+{
+  permission java.lang.RuntimePermission "accessDeclaredMembers";
+  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+  permission java.io.FilePermission "${user.home}/.m2/repository/-", "read";
+};
+
+// RI specs
+grant codeBase "file://${user.home}/.m2/repository/javax/validation/-"
+{
+  permission java.lang.RuntimePermission "accessDeclaredMembers";
+  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+  permission java.io.FilePermission "${user.home}/.m2/repository/-", "read";
+};
+
+grant codeBase "file://${user.home}/.m2/repository/org/apache/bval/-"
+{
+  permission java.lang.RuntimePermission "accessDeclaredMembers";
+  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+};
+
+// test classes
+grant codeBase "file://${project.build.testOutputDirectory}/-"
+{
+  permission java.security.AllPermission;
+};
+
+// classes under test
+grant codeBase "file://${project.build.outputDirectory}/-"
+{
+  permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.bind.*";
+  permission java.lang.RuntimePermission "accessDeclaredMembers";
+  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+  permission java.io.FilePermission "${user.home}/.m2/repository/-", "read";
+  permission java.util.PropertyPermission "*", "read";
+};

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-constraints.xml
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-constraints.xml?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-constraints.xml (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-constraints.xml Fri Oct 12 15:00:48 2018
@@ -0,0 +1,73 @@
+<?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.
+-->
+<constraint-mappings
+    xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation=
+        "http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd">
+  <default-package>org.apache.bval.jsr.example</default-package>
+
+  <bean class="XmlEntitySampleBean" ignore-annotations="false">
+    <class ignore-annotations="true"/>
+    <field name="zipCode">
+      <!--@FrenchZipCode(size=3)-->
+      <constraint annotation="org.apache.bval.constraints.FrenchZipCode">
+        <element name="size">
+          <value>3</value>
+        </element>
+      </constraint>
+
+    </field>
+    <field name="valueCode">
+      <!--<valid/>-->
+      <!-- @HasValue({ 0, 20 }) -->
+      <constraint annotation="org.apache.bval.constraints.HasValue">
+        <element name="value">
+          <value>0</value>
+          <value>20</value>
+        </element>
+      </constraint>
+
+    </field>
+    <getter name="firstName">
+      <!--<valid/>-->
+      <!-- @Size(message="Size is limited",
+                 groups={First.class, Default.class},
+                 max=10
+           )
+      -->
+      <constraint annotation="javax.validation.constraints.Size">
+        <message>Size is limited</message>
+        <groups>
+          <value>org.apache.bval.jsr.example.First</value>
+          <value>javax.validation.groups.Default</value>
+        </groups>
+        <element name="max">10</element>
+      </constraint>
+
+    </getter>
+
+  </bean>
+
+  <constraint-definition annotation="javax.validation.constraints.Size">
+      <validated-by include-existing-validators="false">
+          <value>org.apache.bval.constraints.SizeValidator$ForCharSequence</value>
+      </validated-by>
+  </constraint-definition>
+
+</constraint-mappings>

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation.xml
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation.xml?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation.xml (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation.xml Fri Oct 12 15:00:48 2018
@@ -0,0 +1,29 @@
+<?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.
+-->
+<validation-config
+    xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation=
+        "http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd">
+  <default-provider>org.apache.bval.jsr.ApacheValidationProvider</default-provider>
+  <message-interpolator>org.apache.bval.jsr.xml.TestMessageInterpolator</message-interpolator>
+  <traversable-resolver>org.apache.bval.jsr.resolver.SimpleTraversableResolver</traversable-resolver>
+  <constraint-validator-factory>org.apache.bval.jsr.xml.TestConstraintValidatorFactory</constraint-validator-factory>
+  <constraint-mapping>sample-constraints.xml</constraint-mapping>
+  <property name="test-prop">test-prop-value</property>
+</validation-config>

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation11.xml
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation11.xml?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation11.xml (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation11.xml Fri Oct 12 15:00:48 2018
@@ -0,0 +1,30 @@
+<?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.
+-->
+<validation-config
+    xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation=
+        "http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd"
+    version="1.1">
+  <default-provider>org.apache.bval.jsr.ApacheValidationProvider</default-provider>
+  <message-interpolator>org.apache.bval.jsr.xml.TestMessageInterpolator</message-interpolator>
+  <traversable-resolver>org.apache.bval.jsr.resolver.SimpleTraversableResolver</traversable-resolver>
+  <constraint-validator-factory>org.apache.bval.jsr.xml.TestConstraintValidatorFactory</constraint-validator-factory>
+  <constraint-mapping>sample-constraints.xml</constraint-mapping>
+  <property name="test-prop">test-prop-value</property>
+</validation-config>

Added: tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation2.xml
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation2.xml?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation2.xml (added)
+++ tomee/deps/branches/bval-2/bval-jsr/src/test/resources/sample-validation2.xml Fri Oct 12 15:00:48 2018
@@ -0,0 +1,30 @@
+<?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.
+-->
+<validation-config
+    xmlns="http://xmlns.jcp.org/xml/ns/validation/configuration"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation=
+        "http://xmlns.jcp.org/xml/ns/validation/configuration validation-configuration-2.0.xsd"
+    version="2.0">
+  <default-provider>org.apache.bval.jsr.ApacheValidationProvider</default-provider>
+  <message-interpolator>org.apache.bval.jsr.xml.TestMessageInterpolator</message-interpolator>
+  <traversable-resolver>org.apache.bval.jsr.resolver.SimpleTraversableResolver</traversable-resolver>
+  <constraint-validator-factory>org.apache.bval.jsr.xml.TestConstraintValidatorFactory</constraint-validator-factory>
+  <constraint-mapping>sample-constraints.xml</constraint-mapping>
+  <property name="test-prop">test-prop-value</property>
+</validation-config>

Added: tomee/deps/branches/bval-2/bval-tck/pom.xml
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-tck/pom.xml?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-tck/pom.xml (added)
+++ tomee/deps/branches/bval-2/bval-tck/pom.xml Fri Oct 12 15:00:48 2018
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>bval-parent</artifactId>
+        <groupId>org.apache.bval</groupId>
+        <version>2.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>bval-tck-runner</artifactId>
+    <name>Apache BVal :: bval-tck (TCK Runner)</name>
+    <description>Aggregates dependencies and runs the JSR-349 TCK</description>
+
+    <properties>
+        <tck.version>2.0.3.Final</tck.version>
+        <owb.version>2.0.4</owb.version>
+        <arquillian.version>1.1.11.Final</arquillian.version>
+        <validation.provider>org.apache.bval.jsr.ApacheValidationProvider</validation.provider>
+    </properties>
+
+    <dependencies>
+        <dependency>
+          <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-validation_2.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-atinject_1.0_spec</artifactId>
+            <version>1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jcdi_2.0_spec</artifactId>
+            <version>1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-annotation_1.3_spec</artifactId>
+            <version>1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-interceptor_1.2_spec</artifactId>
+            <version>1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-ejb_3.1_spec</artifactId>
+            <version>1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-el-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.bval</groupId>
+            <artifactId>bval-jsr</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.commons</groupId>
+                    <artifactId>commons-lang3</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.arquillian.container</groupId>
+            <artifactId>arquillian-container-test-spi</artifactId>
+            <version>${arquillian.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.openwebbeans.arquillian</groupId>
+            <artifactId>owb-arquillian-standalone</artifactId>
+            <version>${owb.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.openwebbeans</groupId>
+            <artifactId>openwebbeans-impl</artifactId>
+            <version>${owb.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-jasper-el</artifactId>
+            <version>9.0.5</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate.beanvalidation.tck</groupId>
+            <artifactId>beanvalidation-tck-tests</artifactId>
+            <version>${tck.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>javax.validation</groupId>
+                    <artifactId>validation-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.jboss.spec.javax.interceptor</groupId>
+                    <artifactId>jboss-interceptors-api_1.2_spec</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.arquillian.testng</groupId>
+            <artifactId>arquillian-testng-container</artifactId>
+            <version>${arquillian.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.arquillian.protocol</groupId>
+            <artifactId>arquillian-protocol-servlet</artifactId>
+            <version>${arquillian.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>6.8.21</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <profiles>
+        <profile>
+            <id>tck</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+                <property>
+                    <name>tck</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-deploy-plugin</artifactId>
+                        <configuration>
+                            <skip>true</skip>
+                        </configuration>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <suiteXmlFiles>
+                                <suiteXmlFile>${basedir}/src/test/beanvalidation-tck-tests-suite.xml</suiteXmlFile>
+                            </suiteXmlFiles>
+                            <systemProperties>
+                                <property>
+                                    <name>validation.provider</name>
+                                    <value>${validation.provider}</value>
+                                </property>
+                            </systemProperties>
+                            <parallel>methods</parallel>
+                            <threadCount>4</threadCount>
+                        </configuration>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-report-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>generate-test-report</id>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>report-only</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/surefire-reports</outputDirectory>
+                            <outputName>test-report</outputName>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>

Added: tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/BValArquillianExtension.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/BValArquillianExtension.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/BValArquillianExtension.java (added)
+++ tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/BValArquillianExtension.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,28 @@
+/*
+ * 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.arquillian;
+
+import org.jboss.arquillian.core.spi.LoadableExtension;
+import org.jboss.arquillian.test.spi.TestEnricher;
+
+public class BValArquillianExtension implements LoadableExtension {
+    public void register(final ExtensionBuilder builder) {
+        builder.service(TestEnricher.class, EJBEnricher.class);
+    }
+}

Added: tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/EJBEnricher.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/EJBEnricher.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/EJBEnricher.java (added)
+++ tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/EJBEnricher.java Fri Oct 12 15:00:48 2018
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.arquillian;
+
+import org.jboss.arquillian.test.spi.TestEnricher;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+// mock a very very simple EJB container (in fact only local bean @Resource Validator* injections)
+public class EJBEnricher implements TestEnricher {
+    public void enrich(final Object testCase) {
+        for (final Field field : testCase.getClass().getDeclaredFields()) {
+            if (field.getAnnotation(EJB.class) != null) {
+                try {
+                    final Object instance = field.getType().getConstructor().newInstance();
+                    for (final Field f : field.getType().getDeclaredFields()) {
+                        if (f.getAnnotation(Resource.class) != null) {
+                            if (f.getType().equals(Validator.class)) {
+                                f.set(instance,
+                                    Validation.byDefaultProvider().configure().buildValidatorFactory().getValidator());
+                            } else if (f.getType().equals(ValidatorFactory.class)) {
+                                f.set(instance, Validation.byDefaultProvider().configure().buildValidatorFactory());
+                            }
+                        }
+                    }
+                    field.setAccessible(true);
+                    field.set(testCase, instance);
+                } catch (final Exception e) {
+                    // no-op
+                }
+            }
+        }
+    }
+
+    public Object[] resolve(Method method) {
+        return new Object[0];
+    }
+}

Added: tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/jndi/BValJndiFactory.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/jndi/BValJndiFactory.java?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/jndi/BValJndiFactory.java (added)
+++ tomee/deps/branches/bval-2/bval-tck/src/main/java/org/apache/bval/arquillian/jndi/BValJndiFactory.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.arquillian.jndi;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+import javax.validation.Validation;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Hashtable;
+import java.util.Locale;
+
+// mock a context to satisfy lookups
+public class BValJndiFactory implements InitialContextFactory {
+    public BValJndiFactory() {
+        // this is an ugly hack, but the TCK expects us to get english validation messages :(
+        Locale.setDefault(Locale.ENGLISH);
+    }
+
+    public Context getInitialContext(final Hashtable<?, ?> environment) throws NamingException {
+        return Context.class.cast(Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+            new Class<?>[] { Context.class }, new InvocationHandler() {
+                public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+                    if (method.getName().equals("lookup") && args != null && args.length == 1
+                        && String.class.isInstance(args[0])) {
+                        if ("java:comp/ValidatorFactory".equals(args[0])) {
+                            return Validation.byDefaultProvider().configure().buildValidatorFactory();
+                        }
+                        if ("java:comp/Validator".equals(args[0])) {
+                            return Validation.byDefaultProvider().configure().buildValidatorFactory().getValidator();
+                        }
+                    }
+                    return null;
+                }
+            }));
+    }
+}

Added: tomee/deps/branches/bval-2/bval-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension (added)
+++ tomee/deps/branches/bval-2/bval-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension Fri Oct 12 15:00:48 2018
@@ -0,0 +1 @@
+org.apache.bval.arquillian.BValArquillianExtension

Added: tomee/deps/branches/bval-2/bval-tck/src/main/resources/jndi.properties
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-tck/src/main/resources/jndi.properties?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-tck/src/main/resources/jndi.properties (added)
+++ tomee/deps/branches/bval-2/bval-tck/src/main/resources/jndi.properties Fri Oct 12 15:00:48 2018
@@ -0,0 +1,17 @@
+# 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.
+java.naming.factory.initial = org.apache.bval.arquillian.jndi.BValJndiFactory

Added: tomee/deps/branches/bval-2/bval-tck/src/test/beanvalidation-tck-tests-suite.xml
URL: http://svn.apache.org/viewvc/tomee/deps/branches/bval-2/bval-tck/src/test/beanvalidation-tck-tests-suite.xml?rev=1843674&view=auto
==============================================================================
--- tomee/deps/branches/bval-2/bval-tck/src/test/beanvalidation-tck-tests-suite.xml (added)
+++ tomee/deps/branches/bval-2/bval-tck/src/test/beanvalidation-tck-tests-suite.xml Fri Oct 12 15:00:48 2018
@@ -0,0 +1,36 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+<!--
+
+    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.
+-->
+
+<suite name="JSR-380-TCK" verbose="2" configfailurepolicy="continue">
+    <test name="JSR-380-TCK">
+
+        <method-selectors>
+            <method-selector>
+                <selector-class name="org.hibernate.beanvalidation.tck.util.IntegrationTestsMethodSelector"/>
+            </method-selector>
+            <method-selector>
+                <selector-class name="org.hibernate.beanvalidation.tck.util.JavaFXTestsMethodSelector"/>
+            </method-selector>
+        </method-selectors>
+
+        <packages>
+            <package name="org.hibernate.beanvalidation.tck.tests"/>
+        </packages>
+    </test>
+</suite>



Mime
View raw message