Hibernate SVN: r16984 - in beanvalidation/trunk/validation-tck/src/main: resources and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-30 12:51:13 -0400 (Tue, 30 Jun 2009)
New Revision: 16984
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleBeanDefinitionTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleFieldDefinitionTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleGetterDefinitionTest.java
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-copy.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-field-definitions.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-getter-definitions.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-bean-definitions.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-field-definitions.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-getter-definitions.xml
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/InvalidXmlConfigurationTest.java
beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
Log:
started to map some tests for xml configuration
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/InvalidXmlConfigurationTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/InvalidXmlConfigurationTest.java 2009-06-30 16:40:02 UTC (rev 16983)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/InvalidXmlConfigurationTest.java 2009-06-30 16:51:13 UTC (rev 16984)
@@ -20,6 +20,7 @@
import javax.validation.ValidationException;
+import org.jboss.test.audit.annotations.SpecAssertion;
import org.jboss.testharness.AbstractTest;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.ArtifactType;
@@ -34,11 +35,12 @@
* @author Hardy Ferentschik
*/
@Artifact(artifactType = ArtifactType.JSR303)
-(a)Classes({TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class})
+@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
@ValidationXml(value = "validation-invalid-xml.xml")
public class InvalidXmlConfigurationTest extends AbstractTest {
@Test
+ @SpecAssertion(section = "7", id = "a")
public void testInvalidValidationXml() {
try {
TestUtil.getDefaultValidator();
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleBeanDefinitionTest.java (from rev 16948, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/InvalidXmlConfigurationTest.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleBeanDefinitionTest.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleBeanDefinitionTest.java 2009-06-30 16:51:13 UTC (rev 16984)
@@ -0,0 +1,67 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.xmlconfiguration;
+
+
+import javax.validation.ValidationException;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.testharness.AbstractTest;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ArtifactType;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.jsr303.ValidationXml;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.jsr303.tck.util.TestUtil;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Artifact(artifactType = ArtifactType.JSR303)
+@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
+@ValidationXml(value = "validation-multiple-bean-definitions.xml")
+@Resources(
+ {
+ @Resource(source = "user-constraints.xml",
+ destination = "WEB-INF/classes/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints.xml"),
+ @Resource(source = "user-constraints-copy.xml",
+ destination = "WEB-INF/classes/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-copy.xml")
+ }
+)
+public class MultipleBeanDefinitionTest extends AbstractTest {
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "7.1", id = "b"),
+ @SpecAssertion(section = "7.1", id = "e")
+ })
+ public void testBeanCannotBeDescribedMoreThanOnce() {
+ try {
+ TestUtil.getDefaultValidator();
+ fail();
+ }
+ catch ( ValidationException e ) {
+ // success
+ }
+ }
+}
\ No newline at end of file
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleFieldDefinitionTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleFieldDefinitionTest.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleFieldDefinitionTest.java 2009-06-30 16:51:13 UTC (rev 16984)
@@ -0,0 +1,61 @@
+// $Id: InvalidXmlConfigurationTest.java 16948 2009-06-25 10:10:13Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.xmlconfiguration;
+
+
+import javax.validation.ValidationException;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.testharness.AbstractTest;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ArtifactType;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.jsr303.ValidationXml;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.jsr303.tck.util.TestUtil;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Artifact(artifactType = ArtifactType.JSR303)
+@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
+@ValidationXml(value = "user-constraints-multiple-field-definitions.xml")
+@Resource(source = "user-constraints-multiple-field-definitions.xml",
+ destination = "WEB-INF/classes/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-field-definitions.xml")
+
+public class MultipleFieldDefinitionTest extends AbstractTest {
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "7.1", id = "c"),
+ @SpecAssertion(section = "7.1", id = "e")
+ })
+ public void testFieldMappingCanotOccurMoreThanOnce() {
+ try {
+ TestUtil.getDefaultValidator();
+ fail();
+ }
+ catch ( ValidationException e ) {
+ // success
+ }
+ }
+}
\ No newline at end of file
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleGetterDefinitionTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleGetterDefinitionTest.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MultipleGetterDefinitionTest.java 2009-06-30 16:51:13 UTC (rev 16984)
@@ -0,0 +1,61 @@
+// $Id: InvalidXmlConfigurationTest.java 16948 2009-06-25 10:10:13Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.xmlconfiguration;
+
+
+import javax.validation.ValidationException;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.testharness.AbstractTest;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ArtifactType;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.jsr303.ValidationXml;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.jsr303.tck.util.TestUtil;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Artifact(artifactType = ArtifactType.JSR303)
+@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
+@ValidationXml(value = "user-constraints-multiple-getter-definitions.xml")
+@Resource(source = "user-constraints-multiple-getter-definitions.xml",
+ destination = "WEB-INF/classes/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-getter-definitions.xml")
+
+public class MultipleGetterDefinitionTest extends AbstractTest {
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "7.1", id = "d"),
+ @SpecAssertion(section = "7.1", id = "e")
+ })
+ public void testGetterMappingCanotOccurMoreThanOnce() {
+ try {
+ TestUtil.getDefaultValidator();
+ fail();
+ }
+ catch ( ValidationException e ) {
+ // success
+ }
+ }
+}
\ No newline at end of file
Copied: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-copy.xml (from rev 16948, beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints.xml)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-copy.xml (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-copy.xml 2009-06-30 16:51:13 UTC (rev 16984)
@@ -0,0 +1,60 @@
+<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
+ xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
+ <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration</default-package>
+ <bean class="User" ignore-annotations="false">
+ <class ignore-annotations="true">
+ <group-sequence>
+ <value>User</value>
+ <value>Optional</value>
+ </group-sequence>
+ <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.ConsistentUserInformation">
+ <message>Message from xml</message>
+ <groups>
+ <value>javax.validation.groups.Default</value>
+ </groups>
+ <element name="stringParam">foobar</element>
+ <element name="stringArrayParam">
+ <value>foo</value>
+ <value>bar</value>
+ </element>
+ <element name="intParam">
+ <value>42</value>
+ </element>
+ <element name="patterns">
+ <annotation>
+ <element name="regexp">myRegExp1</element>
+ </annotation>
+ <annotation>
+ <element name="regexp">myRegExp2</element>
+ </annotation>
+ </element>
+ <element name="userType">SELLER</element>
+ </constraint>
+ </class>
+ <field name="lastname">
+ <constraint annotation="javax.validation.constraints.Pattern">
+ <message>Last name has to start with with a capital letter.</message>
+ <element name="regexp">^[A-Z][a-z]+</element>
+ </constraint>
+ </field>
+ <field name="creditcard">
+ <valid/>
+ </field>
+ <getter name="firstname" ignore-annotations="true">
+ <constraint annotation="javax.validation.constraints.Size">
+ <message>Size is limited!</message>
+ <groups>
+ <value>org.hibernate.jsr303.tck.tests.xmlconfiguration.TestGroup</value>
+ <value>javax.validation.groups.Default</value>
+ </groups>
+ <element name="max">10</element>
+ </constraint>
+ </getter>
+ </bean>
+ <constraint-definition annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.ConsistentUserInformation">
+ <validated-by include-existing-validators="false">
+ <value>org.hibernate.jsr303.tck.tests.xmlconfiguration.CustomConsistentUserValidator</value>
+ </validated-by>
+ </constraint-definition>
+</constraint-mappings>
Copied: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-field-definitions.xml (from rev 16948, beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints.xml)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-field-definitions.xml (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-field-definitions.xml 2009-06-30 16:51:13 UTC (rev 16984)
@@ -0,0 +1,19 @@
+<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
+ xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
+ <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration</default-package>
+ <bean class="User" ignore-annotations="false">
+
+ <field name="lastname">
+ <constraint annotation="javax.validation.constraints.Pattern">
+ <message>Last name has to start with with a capital letter.</message>
+ <element name="regexp">^[A-Z][a-z]+</element>
+ </constraint>
+ </field>
+ <field name="lastname">
+ <constraint annotation="javax.validation.constraints.NotNull">
+ </constraint>
+ </field>
+
+ </bean>
+</constraint-mappings>
Added: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-getter-definitions.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-getter-definitions.xml (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-getter-definitions.xml 2009-06-30 16:51:13 UTC (rev 16984)
@@ -0,0 +1,22 @@
+<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
+ xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
+ <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration</default-package>
+ <bean class="User" ignore-annotations="false">
+ <getter name="firstname" ignore-annotations="true">
+ <constraint annotation="javax.validation.constraints.Size">
+ <message>Size is limited!</message>
+ <groups>
+ <value>org.hibernate.jsr303.tck.tests.xmlconfiguration.TestGroup</value>
+ <value>javax.validation.groups.Default</value>
+ </groups>
+ <element name="max">10</element>
+ </constraint>
+ </getter>
+ <getter name="firstname" ignore-annotations="true">
+ <constraint annotation="javax.validation.constraints.NotNull">
+ <message>Cannot be null</message>
+ </constraint>
+ </getter>
+ </bean>
+</constraint-mappings>
Copied: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-bean-definitions.xml (from rev 16948, beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation.xml)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-bean-definitions.xml (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-bean-definitions.xml 2009-06-30 16:51:13 UTC (rev 16984)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <constraint-mapping>org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints.xml</constraint-mapping>
+ <constraint-mapping>org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-copy.xml</constraint-mapping>
+</validation-config>
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-bean-definitions.xml
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-field-definitions.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-field-definitions.xml (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-field-definitions.xml 2009-06-30 16:51:13 UTC (rev 16984)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <constraint-mapping>
+ org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-field-definitions.xml
+ </constraint-mapping>
+</validation-config>
\ No newline at end of file
Added: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-getter-definitions.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-getter-definitions.xml (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-multiple-getter-definitions.xml 2009-06-30 16:51:13 UTC (rev 16984)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <constraint-mapping>
+ org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints-multiple-getter-definitions.xml
+ </constraint-mapping>
+</validation-config>
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml 2009-06-30 16:40:02 UTC (rev 16983)
+++ beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml 2009-06-30 16:51:13 UTC (rev 16984)
@@ -46,10 +46,10 @@
<text>If no group is specified when declaring the constraint on an element, the Default
group is considered declared.</text>
</assertion>
- <assertion id="g" implied="true">
+ <assertion id="g" implied="true">
<text>The type of the groups parameter is Class<?>[].</text>
</assertion>
-
+
<assertion id="h">
<text>Every constraint annotation must define a payload element that specifies which
payload the constraint declaration is associated with. </text>
@@ -977,7 +977,11 @@
</assertion>
</section>
- <section id="7" title="XML deployment descriptor"/>
+ <section id="7" title="XML deployment descriptor">
+ <assertion id="a" testable="true">
+ <text>If the xml configuration file does not validate against the given xsd files a ValidationException is raised. </text>
+ </assertion>
+ </section>
<section id="7.1" title="Constraint definition and declaration">
<assertion id="a">
<text>Specifically when exploring metadata, the Bean Validation provider must ensure
15 years, 6 months
Hibernate SVN: r16983 - hibernate-jdocbook-style/trunk.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-06-30 12:40:02 -0400 (Tue, 30 Jun 2009)
New Revision: 16983
Modified:
hibernate-jdocbook-style/trunk/pom.xml
Log:
HHH-4001 : jDocBook style : org.eclipse.wst artifacts need to be excluded
Modified: hibernate-jdocbook-style/trunk/pom.xml
===================================================================
--- hibernate-jdocbook-style/trunk/pom.xml 2009-06-30 16:09:09 UTC (rev 16982)
+++ hibernate-jdocbook-style/trunk/pom.xml 2009-06-30 16:40:02 UTC (rev 16983)
@@ -76,6 +76,16 @@
<groupId>org.jboss</groupId>
<artifactId>jbossorg-docbook-xslt</artifactId>
<version>1.1.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.eclipse.wst.css</groupId>
+ <artifactId>core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.wst.sse</groupId>
+ <artifactId>core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
15 years, 6 months
Hibernate SVN: r16982 - in core/branches/envers-hibernate-3.3: src/main/java/org/hibernate/envers and 4 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-06-30 12:09:09 -0400 (Tue, 30 Jun 2009)
New Revision: 16982
Added:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/query/StoreDeletedData.java
Modified:
core/branches/envers-hibernate-3.3/pom.xml
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/AuditReaderFactory.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/DefaultRevisionEntity.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java
Log:
svn merge -r 16710:16981 https://svn.jboss.org/repos/hibernate/core/trunk/envers .
Modified: core/branches/envers-hibernate-3.3/pom.xml
===================================================================
--- core/branches/envers-hibernate-3.3/pom.xml 2009-06-30 15:56:49 UTC (rev 16981)
+++ core/branches/envers-hibernate-3.3/pom.xml 2009-06-30 16:09:09 UTC (rev 16982)
@@ -110,13 +110,13 @@
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
- <version>2.2</version>
+ <version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
- <version>3.4.GA</version>
+ <version>3.4.GA</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/AuditReaderFactory.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/AuditReaderFactory.java 2009-06-30 15:56:49 UTC (rev 16981)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/AuditReaderFactory.java 2009-06-30 16:09:09 UTC (rev 16982)
@@ -86,10 +86,7 @@
}
if (entityManager.getDelegate() instanceof EntityManager) {
- entityManager = (EntityManager) entityManager.getDelegate();
- if (entityManager.getDelegate() instanceof Session) {
- return get((Session) entityManager.getDelegate());
- }
+ return get((EntityManager) entityManager.getDelegate());
}
throw new AuditException("Hibernate EntityManager not present!");
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/DefaultRevisionEntity.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/DefaultRevisionEntity.java 2009-06-30 15:56:49 UTC (rev 16981)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/DefaultRevisionEntity.java 2009-06-30 16:09:09 UTC (rev 16982)
@@ -25,6 +25,7 @@
import java.text.DateFormat;
import java.util.Date;
+import java.io.Serializable;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
@@ -34,7 +35,9 @@
* @author Adam Warski (adam at warski dot org)
*/
@MappedSuperclass
-public class DefaultRevisionEntity {
+public class DefaultRevisionEntity implements Serializable {
+ private static final long serialVersionUID = 8530213963961662300L;
+
@Id
@GeneratedValue
@RevisionNumber
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java 2009-06-30 15:56:49 UTC (rev 16981)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java 2009-06-30 16:09:09 UTC (rev 16982)
@@ -36,6 +36,9 @@
// Should the optimistic locking property of an entity be considered unversioned
private final boolean doNotAuditOptimisticLockingField;
+ // Should entity data be stored when it is deleted
+ private final boolean storeDataAtDelete;
+
/*
Which operator to use in correlated subqueries (when we want a property to be equal to the result of
a correlated subquery, for example: e.p <operator> (select max(e2.p) where e2.p2 = e.p2 ...).
@@ -53,6 +56,9 @@
"true");
doNotAuditOptimisticLockingField = Boolean.parseBoolean(ignoreOptimisticLockingPropertyStr);
+ String storeDataDeletedEntityStr = properties.getProperty("org.hibernate.envers.storeDataAtDelete", "false");
+ storeDataAtDelete = Boolean.parseBoolean(storeDataDeletedEntityStr);
+
correlatedSubqueryOperator = "org.hibernate.dialect.HSQLDialect".equals(
properties.getProperty("hibernate.dialect")) ? "in" : "=";
}
@@ -68,4 +74,8 @@
public String getCorrelatedSubqueryOperator() {
return correlatedSubqueryOperator;
}
+
+ public boolean isStoreDataAtDelete() {
+ return storeDataAtDelete;
+ }
}
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java 2009-06-30 15:56:49 UTC (rev 16981)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java 2009-06-30 16:09:09 UTC (rev 16982)
@@ -175,7 +175,7 @@
AuditSync verSync = verCfg.getSyncManager().get(event.getSession());
verSync.addWorkUnit(new DelWorkUnit(event.getSession(), event.getPersister().getEntityName(), verCfg,
- event.getId()));
+ event.getId(), event.getPersister(), event.getDeletedState()));
generateBidirectionalCollectionChangeWorkUnits(verSync, event.getPersister(), entityName, null,
event.getDeletedState(), event.getSession());
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java 2009-06-30 15:56:49 UTC (rev 16981)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java 2009-06-30 16:09:09 UTC (rev 16982)
@@ -31,14 +31,22 @@
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.Session;
+import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.engine.SessionImplementor;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class DelWorkUnit extends AbstractAuditWorkUnit implements AuditWorkUnit {
- public DelWorkUnit(SessionImplementor sessionImplementor, String entityName, AuditConfiguration verCfg, Serializable id) {
+ private final Object[] state;
+ private final String[] propertyNames;
+
+ public DelWorkUnit(SessionImplementor sessionImplementor, String entityName, AuditConfiguration verCfg,
+ Serializable id, EntityPersister entityPersister, Object[] state) {
super(sessionImplementor, entityName, verCfg, id);
+
+ this.state = state;
+ this.propertyNames = entityPersister.getPropertyNames();
}
public boolean containsWork() {
@@ -49,6 +57,11 @@
Map<String, Object> data = new HashMap<String, Object>();
fillDataWithId(data, revisionData, RevisionType.DEL);
+ if (verCfg.getGlobalCfg().isStoreDataAtDelete()) {
+ verCfg.getEntCfg().get(getEntityName()).getPropertyMapper().map(sessionImplementor, data,
+ propertyNames, state, state);
+ }
+
session.save(verCfg.getAuditEntCfg().getAuditEntityName(getEntityName()), data);
setPerformed(data);
Copied: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/query/StoreDeletedData.java (from rev 16981, core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/StoreDeletedData.java)
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/query/StoreDeletedData.java (rev 0)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/query/StoreDeletedData.java 2009-06-30 16:09:09 UTC (rev 16982)
@@ -0,0 +1,82 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.test.integration.query;
+
+import org.hibernate.ejb.Ejb3Configuration;
+import org.hibernate.envers.query.AuditEntity;
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.entities.StrIntTestEntity;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+/**
+ * A test which checks if the data of a deleted entity is stored when the setting is on.
+ * @author Adam Warski (adam at warski dot org)
+ */
+@SuppressWarnings({"unchecked"})
+public class StoreDeletedData extends AbstractEntityTest {
+ private Integer id1;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(StrIntTestEntity.class);
+ cfg.setProperty("org.hibernate.envers.storeDataAtDelete", "true");
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ // Revision 1
+ EntityManager em = getEntityManager();
+ em.getTransaction().begin();
+
+ StrIntTestEntity site1 = new StrIntTestEntity("a", 10);
+
+ em.persist(site1);
+
+ id1 = site1.getId();
+
+ em.getTransaction().commit();
+
+ // Revision 2
+ em.getTransaction().begin();
+
+ em.remove(site1);
+
+ em.getTransaction().commit();
+ }
+
+ @Test
+ public void testRevisionsPropertyEqQuery() {
+ List revs_id1 = getAuditReader().createQuery()
+ .forRevisionsOfEntity(StrIntTestEntity.class, false, true)
+ .add(AuditEntity.id().eq(id1))
+ .getResultList();
+
+ assert revs_id1.size() == 2;
+ assert ((Object[]) revs_id1.get(0))[0].equals(new StrIntTestEntity("a", 10, id1));
+ assert ((Object[]) revs_id1.get(1))[0].equals(new StrIntTestEntity("a", 10, id1));
+ }
+}
\ No newline at end of file
15 years, 6 months
Hibernate SVN: r16981 - in core/trunk: envers/src/main/java/org/hibernate/envers/configuration and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-06-30 11:56:49 -0400 (Tue, 30 Jun 2009)
New Revision: 16981
Added:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/StoreDeletedData.java
Modified:
core/trunk/documentation/envers/src/main/docbook/en-US/content/configuration.xml
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/event/AuditEventListener.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java
Log:
HHH-3819:
- adding an option to store the data when an entity is deleted in the revision (instead of having to read the last-but-one revision)
Modified: core/trunk/documentation/envers/src/main/docbook/en-US/content/configuration.xml
===================================================================
--- core/trunk/documentation/envers/src/main/docbook/en-US/content/configuration.xml 2009-06-30 15:11:37 UTC (rev 16980)
+++ core/trunk/documentation/envers/src/main/docbook/en-US/content/configuration.xml 2009-06-30 15:56:49 UTC (rev 16981)
@@ -133,6 +133,21 @@
(their history won't be stored; it normally doesn't make sense to store it).
</entry>
</row>
+ <row>
+ <entry>
+ <property>org.hibernate.envers.storeDataAtDelete</property>
+ </entry>
+ <entry>
+ false
+ </entry>
+ <entry>
+ Should the entity data be stored in the revision when the entity is deleted (instead of only
+ storing the id and all other properties as null). This is not normally needed, as the data is
+ present in the last-but-one revision. Sometimes, however, it is easier and more efficient to
+ access it in the last revision (then the data that the entity contained before deletion is
+ stored twice).
+ </entry>
+ </row>
</tbody>
</tgroup>
</table>
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java 2009-06-30 15:11:37 UTC (rev 16980)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java 2009-06-30 15:56:49 UTC (rev 16981)
@@ -36,6 +36,9 @@
// Should the optimistic locking property of an entity be considered unversioned
private final boolean doNotAuditOptimisticLockingField;
+ // Should entity data be stored when it is deleted
+ private final boolean storeDataAtDelete;
+
/*
Which operator to use in correlated subqueries (when we want a property to be equal to the result of
a correlated subquery, for example: e.p <operator> (select max(e2.p) where e2.p2 = e.p2 ...).
@@ -53,6 +56,9 @@
"true");
doNotAuditOptimisticLockingField = Boolean.parseBoolean(ignoreOptimisticLockingPropertyStr);
+ String storeDataDeletedEntityStr = properties.getProperty("org.hibernate.envers.storeDataAtDelete", "false");
+ storeDataAtDelete = Boolean.parseBoolean(storeDataDeletedEntityStr);
+
correlatedSubqueryOperator = "org.hibernate.dialect.HSQLDialect".equals(
properties.getProperty("hibernate.dialect")) ? "in" : "=";
}
@@ -68,4 +74,8 @@
public String getCorrelatedSubqueryOperator() {
return correlatedSubqueryOperator;
}
+
+ public boolean isStoreDataAtDelete() {
+ return storeDataAtDelete;
+ }
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/event/AuditEventListener.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/event/AuditEventListener.java 2009-06-30 15:11:37 UTC (rev 16980)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/event/AuditEventListener.java 2009-06-30 15:56:49 UTC (rev 16981)
@@ -174,7 +174,7 @@
AuditSync verSync = verCfg.getSyncManager().get(event.getSession());
verSync.addWorkUnit(new DelWorkUnit(event.getSession(), event.getPersister().getEntityName(), verCfg,
- event.getId()));
+ event.getId(), event.getPersister(), event.getDeletedState()));
generateBidirectionalCollectionChangeWorkUnits(verSync, event.getPersister(), entityName, null,
event.getDeletedState(), event.getSession());
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java 2009-06-30 15:11:37 UTC (rev 16980)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java 2009-06-30 15:56:49 UTC (rev 16981)
@@ -31,14 +31,22 @@
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.Session;
+import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.engine.SessionImplementor;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class DelWorkUnit extends AbstractAuditWorkUnit implements AuditWorkUnit {
- public DelWorkUnit(SessionImplementor sessionImplementor, String entityName, AuditConfiguration verCfg, Serializable id) {
+ private final Object[] state;
+ private final String[] propertyNames;
+
+ public DelWorkUnit(SessionImplementor sessionImplementor, String entityName, AuditConfiguration verCfg,
+ Serializable id, EntityPersister entityPersister, Object[] state) {
super(sessionImplementor, entityName, verCfg, id);
+
+ this.state = state;
+ this.propertyNames = entityPersister.getPropertyNames();
}
public boolean containsWork() {
@@ -49,6 +57,11 @@
Map<String, Object> data = new HashMap<String, Object>();
fillDataWithId(data, revisionData, RevisionType.DEL);
+ if (verCfg.getGlobalCfg().isStoreDataAtDelete()) {
+ verCfg.getEntCfg().get(getEntityName()).getPropertyMapper().map(sessionImplementor, data,
+ propertyNames, state, state);
+ }
+
session.save(verCfg.getAuditEntCfg().getAuditEntityName(getEntityName()), data);
setPerformed(data);
Copied: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/StoreDeletedData.java (from rev 16611, core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java)
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/StoreDeletedData.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/StoreDeletedData.java 2009-06-30 15:56:49 UTC (rev 16981)
@@ -0,0 +1,82 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.test.integration.query;
+
+import org.hibernate.ejb.Ejb3Configuration;
+import org.hibernate.envers.query.AuditEntity;
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.entities.StrIntTestEntity;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+/**
+ * A test which checks if the data of a deleted entity is stored when the setting is on.
+ * @author Adam Warski (adam at warski dot org)
+ */
+@SuppressWarnings({"unchecked"})
+public class StoreDeletedData extends AbstractEntityTest {
+ private Integer id1;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(StrIntTestEntity.class);
+ cfg.setProperty("org.hibernate.envers.storeDataAtDelete", "true");
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ // Revision 1
+ EntityManager em = getEntityManager();
+ em.getTransaction().begin();
+
+ StrIntTestEntity site1 = new StrIntTestEntity("a", 10);
+
+ em.persist(site1);
+
+ id1 = site1.getId();
+
+ em.getTransaction().commit();
+
+ // Revision 2
+ em.getTransaction().begin();
+
+ em.remove(site1);
+
+ em.getTransaction().commit();
+ }
+
+ @Test
+ public void testRevisionsPropertyEqQuery() {
+ List revs_id1 = getAuditReader().createQuery()
+ .forRevisionsOfEntity(StrIntTestEntity.class, false, true)
+ .add(AuditEntity.id().eq(id1))
+ .getResultList();
+
+ assert revs_id1.size() == 2;
+ assert ((Object[]) revs_id1.get(0))[0].equals(new StrIntTestEntity("a", 10, id1));
+ assert ((Object[]) revs_id1.get(1))[0].equals(new StrIntTestEntity("a", 10, id1));
+ }
+}
\ No newline at end of file
15 years, 6 months
Hibernate SVN: r16980 - core/trunk/envers/src/main/java/org/hibernate/envers.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-06-30 11:11:37 -0400 (Tue, 30 Jun 2009)
New Revision: 16980
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java
Log:
Searching for Session recurses when reading delegates of EntityManager
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java 2009-06-30 15:10:53 UTC (rev 16979)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java 2009-06-30 15:11:37 UTC (rev 16980)
@@ -86,10 +86,7 @@
}
if (entityManager.getDelegate() instanceof EntityManager) {
- entityManager = (EntityManager) entityManager.getDelegate();
- if (entityManager.getDelegate() instanceof Session) {
- return get((Session) entityManager.getDelegate());
- }
+ return get((EntityManager) entityManager.getDelegate());
}
throw new AuditException("Hibernate EntityManager not present!");
15 years, 6 months
Hibernate SVN: r16979 - core/trunk/envers/src/main/java/org/hibernate/envers.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-06-30 11:10:53 -0400 (Tue, 30 Jun 2009)
New Revision: 16979
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/DefaultRevisionEntity.java
Log:
- the default revision entity is serializable
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/DefaultRevisionEntity.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/DefaultRevisionEntity.java 2009-06-30 12:45:13 UTC (rev 16978)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/DefaultRevisionEntity.java 2009-06-30 15:10:53 UTC (rev 16979)
@@ -25,6 +25,7 @@
import java.text.DateFormat;
import java.util.Date;
+import java.io.Serializable;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
@@ -34,7 +35,9 @@
* @author Adam Warski (adam at warski dot org)
*/
@MappedSuperclass
-public class DefaultRevisionEntity {
+public class DefaultRevisionEntity implements Serializable {
+ private static final long serialVersionUID = 8530213963961662300L;
+
@Id
@GeneratedValue
@RevisionNumber
15 years, 6 months
Hibernate SVN: r16978 - beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-30 08:45:13 -0400 (Tue, 30 Jun 2009)
New Revision: 16978
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidGroupsType.java
Log:
HV-178
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidGroupsType.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidGroupsType.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidGroupsType.java 2009-06-30 12:45:13 UTC (rev 16978)
@@ -0,0 +1,52 @@
+// $Id: InvalidDefaultGroup.java 16691 2009-06-04 09:18:14Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Documented
+@Constraint(validatedBy = InvalidGroupsType.InvalidDefaultGroupValidator.class)
+@Target({ TYPE })
+@Retention(RUNTIME)
+public @interface InvalidGroupsType {
+ public abstract String message() default "";
+
+ public abstract String groups() default "";
+
+ public abstract Class<?>[] payload() default { };
+
+ public class InvalidDefaultGroupValidator implements ConstraintValidator<InvalidGroupsType, Object> {
+
+ public void initialize(InvalidGroupsType parameters) {
+ }
+
+ public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
+ return false;
+ }
+ }
+}
\ No newline at end of file
15 years, 6 months
Hibernate SVN: r16977 - beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition and 13 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-30 08:37:35 -0400 (Tue, 30 Jun 2009)
New Revision: 16977
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidDefaultPayload.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidMessageType.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidPayloadClass.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoPayload.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ValidInPropertyName.java
Removed:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityInvalidDefaultGroup.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityNoGroups.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityNoMessage.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityValidProperty.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ValidProperty.java
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/application/SecurityCheck.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcode.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeWithInvalidOverride.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanZipcode.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/NotEmpty.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValid.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/ZipCodeCoherenceChecker.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/IsAdult.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/SafeEncryption.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidConstraintDefinitionsTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidDefaultGroup.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoGroups.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoMessage.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambigious.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/PostCodeList.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountChecker.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/NotEmpty.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/customconstraint/Negative.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/customconstraint/Positive.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/Dummy.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/MyConstraint.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/MySecondConstraint.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/ConsistentUserInformation.java
beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/NotEmpty.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java
Log:
HV-178 - Add check for payload parameter
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/application/SecurityCheck.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/application/SecurityCheck.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/application/SecurityCheck.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -27,6 +27,7 @@
import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintPayload;
/**
* @author Hardy Ferentschik
@@ -40,6 +41,8 @@
public abstract Class<?>[] groups() default { };
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
+
public class SecurityCheckValidator implements ConstraintValidator<SecurityCheck, Object> {
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcode.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcode.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcode.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -26,6 +26,7 @@
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.OverridesAttribute;
+import javax.validation.ConstraintPayload;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
@@ -46,6 +47,8 @@
Class<?>[] groups() default { };
+ Class<? extends ConstraintPayload>[] payload() default {};
+
@OverridesAttribute.List({
@OverridesAttribute(constraint = Size.class, name = "min"),
@OverridesAttribute(constraint = Size.class, name = "max")
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeWithInvalidOverride.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeWithInvalidOverride.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeWithInvalidOverride.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -26,6 +26,7 @@
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.OverridesAttribute;
+import javax.validation.ConstraintPayload;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
@@ -46,6 +47,8 @@
public abstract Class<?>[] groups() default { };
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
+
@OverridesAttribute.List({
@OverridesAttribute(constraint = Size.class, name = "min"),
@OverridesAttribute(constraint = Size.class, name = "max")
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanZipcode.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanZipcode.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanZipcode.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -28,6 +28,7 @@
import javax.validation.ReportAsSingleViolation;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintPayload;
/**
* Constraint used to test nested composing constraints.
@@ -45,6 +46,8 @@
public abstract Class<?>[] groups() default { };
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
+
public class GermanZipcodeConstraintValidator implements ConstraintValidator<GermanZipcode, String> {
public void initialize(GermanZipcode parameters) {
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/NotEmpty.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/NotEmpty.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/NotEmpty.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
@@ -27,6 +27,7 @@
import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintPayload;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@@ -44,6 +45,8 @@
Class<?>[] groups() default { };
+ Class<? extends ConstraintPayload>[] payload() default {};
+
public class NotEmptyValidator implements ConstraintValidator<NotEmpty, String> {
public void initialize(NotEmpty parameters) {
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValid.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValid.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValid.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -27,6 +27,7 @@
import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintPayload;
/**
* @author Hardy Ferentschik
@@ -42,6 +43,8 @@
public abstract boolean alwaysValid();
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
+
public class StaticConstraintValidator implements ConstraintValidator<AlwaysValid, Object> {
boolean valid;
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/ZipCodeCoherenceChecker.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/ZipCodeCoherenceChecker.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/ZipCodeCoherenceChecker.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -7,6 +7,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
/**
* @author Emmanuel Bernard
@@ -19,4 +20,6 @@
public abstract String message() default "Zip code is not coherent.";
public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends ConstraintPayload>[] payload() default { };
}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/IsAdult.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/IsAdult.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/IsAdult.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -27,6 +27,7 @@
import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintPayload;
/**
* @author Hardy Ferentschik
@@ -40,7 +41,9 @@
public abstract Class<?>[] groups() default { };
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
+
public class IsAdultValidator implements ConstraintValidator<IsAdult, Integer> {
public void initialize(IsAdult parameters) {
}
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/SafeEncryption.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/SafeEncryption.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/SafeEncryption.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -25,6 +25,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
@@ -40,6 +41,7 @@
public abstract Class<?>[] groups() default { };
+ public abstract Class<? extends ConstraintPayload>[] payload() default { };
public class SafeEncryptionValidator implements ConstraintValidator<SafeEncryption, String> {
public void initialize(SafeEncryption parameters) {
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityInvalidDefaultGroup.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityInvalidDefaultGroup.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityInvalidDefaultGroup.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -1,25 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
-
-/**
- * @author Hardy Ferentschik
- */
-@InvalidDefaultGroup
-public class DummyEntityInvalidDefaultGroup {
-}
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityNoGroups.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityNoGroups.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityNoGroups.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -1,25 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
-
-/**
- * @author Hardy Ferentschik
- */
-@NoGroups
-public class DummyEntityNoGroups {
-}
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityNoMessage.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityNoMessage.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityNoMessage.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -1,25 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
-
-/**
- * @author Hardy Ferentschik
- */
-@NoMessage
-public class DummyEntityNoMessage {
-}
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityValidProperty.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityValidProperty.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/DummyEntityValidProperty.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -1,25 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
-
-/**
- * @author Hardy Ferentschik
- */
-@ValidProperty
-public class DummyEntityValidProperty {
-}
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidConstraintDefinitionsTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidConstraintDefinitionsTest.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidConstraintDefinitionsTest.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -35,7 +35,7 @@
* @author Hardy Ferentschik
*/
@Artifact(artifactType = ArtifactType.JSR303)
-(a)Classes({TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class})
+@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
public class InvalidConstraintDefinitionsTest extends AbstractTest {
@Test
@@ -84,7 +84,7 @@
try {
Validator validator = TestUtil.getDefaultValidator();
validator.validate( new DummyEntityNoGroups() );
- fail( "The used constraint does not define a groups paramter. The validation should have failed." );
+ fail( "The used constraint does not define a groups parameter. The validation should have failed." );
}
catch ( ConstraintDefinitionException e ) {
// success
@@ -94,6 +94,23 @@
@Test
@SpecAssertions({
@SpecAssertion(section = "2.1", id = "c"),
+ @SpecAssertion(section = "2.1.1", id = "h"),
+ @SpecAssertion(section = "8.2", id = "a")
+ })
+ public void testConstraintDefinitionWithoutPayloadParameter() {
+ try {
+ Validator validator = TestUtil.getDefaultValidator();
+ validator.validate( new DummyEntityNoGroups() );
+ fail( "The used constraint does not define a payload parameter. The validation should have failed." );
+ }
+ catch ( ConstraintDefinitionException e ) {
+ // success
+ }
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "2.1", id = "c"),
@SpecAssertion(section = "2.1.1", id = "e"),
@SpecAssertion(section = "8.2", id = "a")
})
@@ -101,10 +118,114 @@
try {
Validator validator = TestUtil.getDefaultValidator();
validator.validate( new DummyEntityInvalidDefaultGroup() );
- fail( "The default groups paramter is not the empty array. The validation should have failed." );
+ fail( "The default groups parameter is not the empty array. The validation should have failed." );
}
catch ( ConstraintDefinitionException e ) {
// success
}
}
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "2.1", id = "c"),
+ @SpecAssertion(section = "2.1.1", id = "i"),
+ @SpecAssertion(section = "8.2", id = "a")
+ })
+ public void testConstraintDefinitionWithWrongDefaultPayloadValue() {
+ try {
+ Validator validator = TestUtil.getDefaultValidator();
+ validator.validate( new DummyEntityInvalidDefaultPayload() );
+ fail( "The default payload parameter is not the empty array. The validation should have failed." );
+ }
+ catch ( ConstraintDefinitionException e ) {
+ // success
+ }
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "2.1", id = "c"),
+ @SpecAssertion(section = "2.1.1", id = "j"),
+ @SpecAssertion(section = "8.2", id = "a")
+ })
+ public void testConstraintDefinitionWithWrongPayloadClass() {
+ try {
+ Validator validator = TestUtil.getDefaultValidator();
+ validator.validate( new DummyEntityInvalidPayloadClass() );
+ fail( "The default payload parameter has to be of type Class<? extends ConstraintPayload>[]. The validation should have failed." );
+ }
+ catch ( ConstraintDefinitionException e ) {
+ // success
+ }
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "2.1", id = "c"),
+ @SpecAssertion(section = "2.1.1", id = "c"),
+ @SpecAssertion(section = "8.2", id = "a")
+ })
+ public void testConstraintDefinitionWithWrongMessageType() {
+ try {
+ Validator validator = TestUtil.getDefaultValidator();
+ validator.validate( new DummyEntityInvalidMessageType() );
+ fail( "The message parameter has to be of type String. The validation should have failed." );
+ }
+ catch ( ConstraintDefinitionException e ) {
+ // success
+ }
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "2.1", id = "c"),
+ @SpecAssertion(section = "2.1.1", id = "g"),
+ @SpecAssertion(section = "8.2", id = "a")
+ })
+ public void testConstraintDefinitionWithWrongGroupType() {
+ try {
+ Validator validator = TestUtil.getDefaultValidator();
+ validator.validate( new DummyEntityInvalidGroupsType() );
+ fail( "The groups parameter has to be of type Class<?>[]. The validation should have failed." );
+ }
+ catch ( ConstraintDefinitionException e ) {
+ // success
+ }
+ }
+
+ @InvalidDefaultGroup
+ public class DummyEntityInvalidDefaultGroup {
+ }
+
+ @NoGroups
+ public class DummyEntityNoGroups {
+ }
+
+ @NoMessage
+ public class DummyEntityNoMessage {
+ }
+
+ @ValidInPropertyName
+ public class DummyEntityValidProperty {
+ }
+
+ @NoPayload
+ public class DummyEntityNoPayload {
+ }
+
+ @InvalidDefaultPayload
+ public class DummyEntityInvalidDefaultPayload {
+ }
+
+ @InvalidPayloadClass
+ public class DummyEntityInvalidPayloadClass {
+ }
+
+ @InvalidMessageType
+ public class DummyEntityInvalidMessageType {
+ }
+
+ @InvalidGroupsType
+ public class DummyEntityInvalidGroupsType {
+ }
}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidDefaultGroup.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidDefaultGroup.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidDefaultGroup.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -25,6 +25,7 @@
import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintPayload;
import javax.validation.groups.Default;
/**
@@ -39,6 +40,8 @@
public abstract Class<?>[] groups() default Default.class;
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
+
public class InvalidDefaultGroupValidator implements ConstraintValidator<InvalidDefaultGroup, Object> {
public void initialize(InvalidDefaultGroup parameters) {
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidDefaultPayload.java (from rev 16948, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidDefaultGroup.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidDefaultPayload.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidDefaultPayload.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -0,0 +1,57 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Documented
+@Constraint(validatedBy = InvalidDefaultPayload.InvalidDefaultGroupValidator.class)
+@Target({ TYPE })
+@Retention(RUNTIME)
+public @interface InvalidDefaultPayload {
+ public abstract String message() default "default message";
+
+ public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends ConstraintPayload>[] payload() default DummyPayload.class;
+
+ public class DummyPayload implements ConstraintPayload {
+
+ }
+
+ public class InvalidDefaultGroupValidator implements ConstraintValidator<InvalidDefaultPayload, Object> {
+
+ public void initialize(InvalidDefaultPayload parameters) {
+ }
+
+ public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
+ return false;
+ }
+ }
+}
\ No newline at end of file
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidMessageType.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidMessageType.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidMessageType.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -0,0 +1,52 @@
+// $Id: InvalidDefaultGroup.java 16691 2009-06-04 09:18:14Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Documented
+@Constraint(validatedBy = InvalidMessageType.InvalidDefaultGroupValidator.class)
+@Target({ TYPE })
+@Retention(RUNTIME)
+public @interface InvalidMessageType {
+ public abstract Class<?> message() default void.class;
+
+ public abstract Class<?>[] groups() default { };
+
+ public abstract Class<?>[] payload() default { };
+
+ public class InvalidDefaultGroupValidator implements ConstraintValidator<InvalidMessageType, Object> {
+
+ public void initialize(InvalidMessageType parameters) {
+ }
+
+ public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
+ return false;
+ }
+ }
+}
\ No newline at end of file
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidPayloadClass.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidPayloadClass.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidPayloadClass.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -0,0 +1,52 @@
+// $Id: InvalidDefaultGroup.java 16691 2009-06-04 09:18:14Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Documented
+@Constraint(validatedBy = InvalidPayloadClass.InvalidDefaultGroupValidator.class)
+@Target({ TYPE })
+@Retention(RUNTIME)
+public @interface InvalidPayloadClass {
+ public abstract String message() default "default message";
+
+ public abstract Class<?>[] groups() default { };
+
+ public abstract String payload() default "";
+
+ public class InvalidDefaultGroupValidator implements ConstraintValidator<InvalidPayloadClass, Object> {
+
+ public void initialize(InvalidPayloadClass parameters) {
+ }
+
+ public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
+ return false;
+ }
+ }
+}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoGroups.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoGroups.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoGroups.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -23,6 +23,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
@@ -36,6 +37,8 @@
public @interface NoGroups {
String message() default "default message";
+ Class<? extends ConstraintPayload>[] payload() default { };
+
public class NoGroupsValidator implements ConstraintValidator<NoGroups, Object> {
public void initialize(NoGroups parameters) {
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoMessage.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoMessage.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoMessage.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -23,6 +23,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
@@ -36,6 +37,8 @@
public @interface NoMessage {
Class<?>[] groups() default { };
+ Class<? extends ConstraintPayload>[] payload() default { };
+
public class NoMessageValidator implements ConstraintValidator<NoMessage, Object> {
public void initialize(NoMessage parameters) {
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoPayload.java (from rev 16948, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoGroups.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoPayload.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/NoPayload.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -0,0 +1,50 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Documented
+@Constraint(validatedBy = NoPayload.NoGroupsValidator.class)
+@Target({ TYPE })
+@Retention(RUNTIME)
+public @interface NoPayload {
+ public abstract String message() default "default message";
+
+ public abstract Class<?>[] groups() default { };
+
+ public class NoGroupsValidator implements ConstraintValidator<NoPayload, Object> {
+
+ public void initialize(NoPayload parameters) {
+ }
+
+ public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
+ return false;
+ }
+ }
+}
\ No newline at end of file
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ValidInPropertyName.java (from rev 16948, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ValidProperty.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ValidInPropertyName.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ValidInPropertyName.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -0,0 +1,55 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Documented
+@Constraint(validatedBy = ValidInPropertyName.ValidPropertyValidator.class)
+@Target({ TYPE })
+@Retention(RUNTIME)
+public @interface ValidInPropertyName {
+ String message() default "default message";
+
+ Class<?>[] groups() default { };
+
+ Class<? extends ConstraintPayload>[] payload() default { };
+
+ int validLength() default 0;
+
+ public class ValidPropertyValidator implements ConstraintValidator<ValidInPropertyName, Object> {
+
+ public void initialize(ValidInPropertyName parameters) {
+ }
+
+ public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
+ return false;
+ }
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ValidInPropertyName.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ValidProperty.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ValidProperty.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ValidProperty.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -1,52 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.TYPE;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-/**
- * @author Hardy Ferentschik
- */
-@Documented
-@Constraint(validatedBy = ValidProperty.ValidPropertyValidator.class)
-@Target({ TYPE })
-@Retention(RUNTIME)
-public @interface ValidProperty {
- String message() default "default message";
-
- Class<?>[] groups() default { };
-
- int validLength() default 0;
-
- public class ValidPropertyValidator implements ConstraintValidator<ValidProperty, Object> {
-
- public void initialize(ValidProperty parameters) {
- }
-
- public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
- return false;
- }
- }
-}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambigious.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambigious.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambigious.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -28,6 +28,7 @@
import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintPayload;
/**
* A test constraint which can lead to a error when trying to reslove the validator.
@@ -45,7 +46,9 @@
public abstract Class<?>[] groups() default { };
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
+
public class AmbigiousValidatorForBar implements ConstraintValidator<Ambigious, Bar> {
public void initialize(Ambigious parameters) {
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/PostCodeList.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/PostCodeList.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/PostCodeList.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -28,6 +28,7 @@
import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintPayload;
/**
* A test constraint which can lead to a error when trying to reslove the validator.
@@ -45,6 +46,8 @@
public abstract Class<?>[] groups() default { };
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
+
public class PostCodeListValidatorForNumber
implements ConstraintValidator<PostCodeList, Collection<? extends Number>> {
public void initialize(PostCodeList constraintAnnotation) {
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountChecker.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountChecker.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountChecker.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -25,6 +25,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
/**
* @author Hardy Ferentschik
@@ -38,4 +39,6 @@
public abstract String message() default "Account information inconsistent.";
public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
}
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/NotEmpty.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/NotEmpty.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/NotEmpty.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -24,6 +24,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
import javax.validation.OverridesAttribute;
import javax.validation.ReportAsSingleViolation;
import javax.validation.constraints.NotNull;
@@ -44,6 +45,8 @@
public abstract Class<?>[] groups() default { };
+ public abstract Class<? extends ConstraintPayload>[] payload() default { };
+
@OverridesAttribute(constraint = Size.class, name = "min")
public abstract int min() default 5;
}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/customconstraint/Negative.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/customconstraint/Negative.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/customconstraint/Negative.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -25,6 +25,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
/**
* @author Emmanuel Bernard
@@ -37,4 +38,6 @@
public abstract String message() default "{validation.negative}";
public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/customconstraint/Positive.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/customconstraint/Positive.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/customconstraint/Positive.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -17,23 +17,27 @@
*/
package org.hibernate.jsr303.tck.tests.validation.customconstraint;
-import java.lang.annotation.Target;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
-import java.lang.annotation.Documented;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
/**
* @author Emmanuel Bernard
*/
-@Constraint( validatedBy = { PositiveConstraintValidator.class })
+@Constraint(validatedBy = { PositiveConstraintValidator.class })
@Target({ METHOD, FIELD, ANNOTATION_TYPE })
@Retention(RUNTIME)
@Documented
public @interface Positive {
public abstract String message() default "{validation.positive}";
- public abstract Class<?>[] groups() default {};
+
+ public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends ConstraintPayload>[] payload() default { };
}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/Dummy.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/Dummy.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/Dummy.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -24,6 +24,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
/**
* @author Hardy Ferentschik
@@ -36,4 +37,6 @@
String message() default "dummy message";
Class<?>[] groups() default { };
+
+ Class<? extends ConstraintPayload>[] payload() default { };
}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/MyConstraint.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/MyConstraint.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/MyConstraint.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -25,6 +25,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
/**
* @author Hardy Ferentschik
@@ -37,4 +38,6 @@
public abstract String message() default "my constraint failed";
public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/MySecondConstraint.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/MySecondConstraint.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/MySecondConstraint.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -25,6 +25,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
/**
* @author Hardy Ferentschik
@@ -37,4 +38,6 @@
public abstract String message() default "my second constraint failed.";
public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends ConstraintPayload>[] payload() default { };
}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/ConsistentUserInformation.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/ConsistentUserInformation.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/ConsistentUserInformation.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -25,6 +25,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
import javax.validation.constraints.Pattern;
@@ -40,6 +41,8 @@
public abstract Class<?>[] groups() default { };
+ public abstract Class<? extends ConstraintPayload>[] payload() default {};
+
public abstract String stringParam() default "";
public abstract String[] stringArrayParam() default { };
Modified: beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml 2009-06-30 10:22:13 UTC (rev 16976)
+++ beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml 2009-06-30 12:37:35 UTC (rev 16977)
@@ -46,14 +46,18 @@
<text>If no group is specified when declaring the constraint on an element, the Default
group is considered declared.</text>
</assertion>
- <assertion id="g">
+ <assertion id="g" implied="true">
+ <text>The type of the groups parameter is Class<?>[].</text>
+ </assertion>
+
+ <assertion id="h">
<text>Every constraint annotation must define a payload element that specifies which
payload the constraint declaration is associated with. </text>
</assertion>
- <assertion id="h">
+ <assertion id="i">
<text>The default value for the payload parameter must be an empty array. </text>
</assertion>
- <assertion id="i">
+ <assertion id="j">
<text>Each attachable payload extends ConstraintPayload. </text>
</assertion>
</section>
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/NotEmpty.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/NotEmpty.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/NotEmpty.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -24,6 +24,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
+import javax.validation.ConstraintPayload;
import javax.validation.ReportAsSingleViolation;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@@ -32,14 +33,16 @@
* @author Emmanuel Bernard
*/
@Documented
-@Constraint(validatedBy = {})
+@Constraint(validatedBy = { })
@Target({ METHOD, FIELD })
@Retention(RUNTIME)
@ReportAsSingleViolation
@NotNull
-@Size(min=1)
+@Size(min = 1)
public @interface NotEmpty {
String message() default "{org.hibernate.validation.constraints.NotEmpty.message}";
Class<?>[] groups() default { };
+
+ Class<? extends ConstraintPayload>[] payload() default { };
}
\ No newline at end of file
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java 2009-06-30 10:22:13 UTC (rev 16976)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java 2009-06-30 12:37:35 UTC (rev 16977)
@@ -262,6 +262,7 @@
* <li>Has to contain a <code>ConstraintValidator</code> implementation.</li>
* <li>Defines a message parameter.</li>
* <li>Defines a group parameter.</li>
+ * <li>Defines a payload parameter.</li>
* </ul>
*
* @param annotation The annotation to test.
@@ -276,15 +277,50 @@
return false;
}
+ assertMessageParameterExists( annotation );
+ assertGroupsParameterExists( annotation );
+ assertPayloadParameterExists( annotation );
+
+ assertNoParameterStartsWithValid( annotation );
+
+ return true;
+ }
+
+ private void assertNoParameterStartsWithValid(Annotation annotation) {
+ Method[] methods = annotation.getClass().getMethods();
+ for ( Method m : methods ) {
+ if ( m.getName().startsWith( "valid" ) ) {
+ String msg = "Parameters starting with 'valid' are not allowed in a constraint.";
+ throw new ConstraintDefinitionException( msg );
+ }
+ }
+ }
+
+ private void assertPayloadParameterExists(Annotation annotation) {
try {
- ReflectionHelper.getAnnotationParameter( annotation, "message", String.class );
+ Class<?>[] defaultPayload = ( Class<?>[] ) annotation.annotationType()
+ .getMethod( "payload" )
+ .getDefaultValue();
+ if ( defaultPayload.length != 0 ) {
+ String msg = annotation.annotationType()
+ .getName() + " contains Constraint annotation, but the payload " +
+ "paramter default value is not the empty array.";
+ throw new ConstraintDefinitionException( msg );
+ }
}
- catch ( Exception e ) {
+ catch ( ClassCastException e ) {
+ String msg = annotation.annotationType().getName() + " contains Constraint annotation, but the " +
+ "payload parameter is of wrong type.";
+ throw new ConstraintDefinitionException( msg );
+ }
+ catch ( NoSuchMethodException nsme ) {
String msg = annotation.annotationType().getName() + " contains Constraint annotation, but does " +
- "not contain a message parameter.";
+ "not contain a groups parameter.";
throw new ConstraintDefinitionException( msg );
}
+ }
+ private void assertGroupsParameterExists(Annotation annotation) {
try {
Class<?>[] defaultGroups = ( Class<?>[] ) annotation.annotationType()
.getMethod( "groups" )
@@ -292,24 +328,31 @@
if ( defaultGroups.length != 0 ) {
String msg = annotation.annotationType()
.getName() + " contains Constraint annotation, but the groups " +
- "paramter default value is not empty.";
+ "paramter default value is not the empty array.";
throw new ConstraintDefinitionException( msg );
}
}
+ catch ( ClassCastException e ) {
+ String msg = annotation.annotationType().getName() + " contains Constraint annotation, but the " +
+ "groups parameter is of wrong type.";
+ throw new ConstraintDefinitionException( msg );
+ }
catch ( NoSuchMethodException nsme ) {
String msg = annotation.annotationType().getName() + " contains Constraint annotation, but does " +
"not contain a groups parameter.";
throw new ConstraintDefinitionException( msg );
}
+ }
- Method[] methods = annotation.getClass().getMethods();
- for ( Method m : methods ) {
- if ( m.getName().startsWith( "valid" ) ) {
- String msg = "Parameters starting with 'valid' are not allowed in a constraint.";
- throw new ConstraintDefinitionException( msg );
- }
+ private void assertMessageParameterExists(Annotation annotation) {
+ try {
+ ReflectionHelper.getAnnotationParameter( annotation, "message", String.class );
}
- return true;
+ catch ( Exception e ) {
+ String msg = annotation.annotationType().getName() + " contains Constraint annotation, but does " +
+ "not contain a message parameter.";
+ throw new ConstraintDefinitionException( msg );
+ }
}
public <T extends Annotation> List<Class<? extends ConstraintValidator<T, ?>>> getConstraintValidatorDefinition(Class<T> annotationClass) {
@@ -317,7 +360,9 @@
throw new IllegalArgumentException( "Class cannot be null" );
}
- final List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> list = constraintValidatorDefinitons.get( annotationClass );
+ final List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> list = constraintValidatorDefinitons.get(
+ annotationClass
+ );
List<Class<? extends ConstraintValidator<T, ?>>> constraintsValidators =
new ArrayList<Class<? extends ConstraintValidator<T, ?>>>( list.size() );
15 years, 6 months
Hibernate SVN: r16976 - beanvalidation/trunk/validation-tck/src/main/resources.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-30 06:22:13 -0400 (Tue, 30 Jun 2009)
New Revision: 16976
Modified:
beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
Log:
HV-178
Modified: beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml 2009-06-30 10:17:17 UTC (rev 16975)
+++ beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml 2009-06-30 10:22:13 UTC (rev 16976)
@@ -53,7 +53,7 @@
<assertion id="h">
<text>The default value for the payload parameter must be an empty array. </text>
</assertion>
- <assertion id="h">
+ <assertion id="i">
<text>Each attachable payload extends ConstraintPayload. </text>
</assertion>
</section>
15 years, 6 months
Hibernate SVN: r16975 - beanvalidation/trunk/validation-tck/src/main/resources.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-30 06:17:17 -0400 (Tue, 30 Jun 2009)
New Revision: 16975
Modified:
beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
Log:
HV-178
Modified: beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml 2009-06-30 09:16:27 UTC (rev 16974)
+++ beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml 2009-06-30 10:17:17 UTC (rev 16975)
@@ -46,6 +46,16 @@
<text>If no group is specified when declaring the constraint on an element, the Default
group is considered declared.</text>
</assertion>
+ <assertion id="g">
+ <text>Every constraint annotation must define a payload element that specifies which
+ payload the constraint declaration is associated with. </text>
+ </assertion>
+ <assertion id="h">
+ <text>The default value for the payload parameter must be an empty array. </text>
+ </assertion>
+ <assertion id="h">
+ <text>Each attachable payload extends ConstraintPayload. </text>
+ </assertion>
</section>
<section id="2.2" title="Applying multiple constraints of the same type">
@@ -625,8 +635,8 @@
</section>
<section id="4.3.1.1" title="Default message interpolation algorithm">
<assertion id="a">
- <text>Message parameters are extracted from the message string and used as keys to search the ResourceBundle
- named ValidationMessages (step1)</text>
+ <text>Message parameters are extracted from the message string and used as keys to
+ search the ResourceBundle named ValidationMessages (step1)</text>
</assertion>
<assertion id="b">
<text>Step 1 is applied recursively until no replacement is performed</text>
@@ -634,8 +644,8 @@
<assertion id="c">
<text>Message parameters are extracted from the message string and used as keys to
search the Bean Validation provider's built-in ResourceBundle using the defined
- locale. If a property is found, the message parameter is replaced with
- the property value in the message string (step 2)</text>
+ locale. If a property is found, the message parameter is replaced with the property
+ value in the message string (step 2)</text>
</assertion>
<assertion id="e">
<text>Contrary to step 1, step 2 is not processed recursively</text>
@@ -644,8 +654,9 @@
<text>If step 2 triggers a replacement, then step 1 is applied again</text>
</assertion>
<assertion id="g">
- <text>As last step message parameters are extracted from the message string. Those matching the name
- of an attribute of the constraint declaration are replaced by the value of that attribute.</text>
+ <text>As last step message parameters are extracted from the message string. Those
+ matching the name of an attribute of the constraint declaration are replaced by the
+ value of that attribute.</text>
</assertion>
<assertion id="h">
<text>if the locale is passed to the interpolator method interpolate(String,
15 years, 6 months