[hibernate-commits] Hibernate SVN: r17359 - in beanvalidation/trunk/validation-tck/src/main: resources and 1 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Aug 19 08:49:16 EDT 2009


Author: hardy.ferentschik
Date: 2009-08-19 08:49:16 -0400 (Wed, 19 Aug 2009)
New Revision: 17359

Added:
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.java
   beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.xml
Modified:
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/XmlConfigurationTest.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/XmlDefinedMessageInterpolator.java
   beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints.xml
   beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
Log:
xml based tests

Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.java (from rev 17356, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MessageInterpolatorSpecifiedInValidationXmlTest.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.java	2009-08-19 12:49:16 UTC (rev 17359)
@@ -0,0 +1,67 @@
+// $Id: InvalidXmlConfigurationTest.java 17352 2009-08-18 17:08:59Z 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.jsr303.ValidationXml;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.jsr303.tck.common.TCKValidationProvider;
+import org.hibernate.jsr303.tck.common.TCKValidatorConfiguration;
+import org.hibernate.jsr303.tck.util.TestUtil;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Artifact(artifactType = ArtifactType.JSR303)
+ at Classes({
+		TestUtil.class,
+		TestUtil.PathImpl.class,
+		TestUtil.NodeImpl.class,
+		TCKValidationProvider.class,
+		TCKValidatorConfiguration.class,
+		TCKValidationProvider.DummyValidatorFactory.class
+})
+ at ValidationXml(value = "validation-MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.xml")
+public class MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest extends AbstractTest {
+
+	@Test
+	@SpecAssertions({
+			@SpecAssertion(section = "4.4.6", id = "g"),
+			@SpecAssertion(section = "4.4.6", id = "q")
+	})
+	public void testMessageInterpolatorSpecifiedInValidationXmlHasNoDefaultConstructor() {
+		try {
+			TestUtil.getValidatorUnderTest();
+			fail( "Bootstrapping should have failed due to mising no-arg constructor in MessageInterpolator" );
+		}
+		catch ( ValidationException e ) {
+			// success
+			System.err.println( e.getMessage() );
+		}
+	}
+}
\ No newline at end of file

Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/XmlConfigurationTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/XmlConfigurationTest.java	2009-08-19 12:48:52 UTC (rev 17358)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/XmlConfigurationTest.java	2009-08-19 12:49:16 UTC (rev 17359)
@@ -55,7 +55,10 @@
 
 	@Test
 	@SpecAssertions({
-			@SpecAssertion(section = "4.4.6", id = "a")
+			@SpecAssertion(section = "4.4.6", id = "a"),
+			@SpecAssertion(section = "4.4.6", id = "l"),
+			@SpecAssertion(section = "7.1.1", id = "a"),
+			@SpecAssertion(section = "7.1.2", id = "a")
 	})
 	public void testClassConstraintDefinedInXml() {
 		Validator validator = TestUtil.getValidatorUnderTest();
@@ -74,7 +77,10 @@
 
 	@Test
 	@SpecAssertions({
-			@SpecAssertion(section = "4.4.6", id = "b")
+			@SpecAssertion(section = "4.4.6", id = "b"),
+			@SpecAssertion(section = "4.4.6", id = "l"),
+			@SpecAssertion(section = "7.1.1", id = "a"),
+			@SpecAssertion(section = "7.1.2", id = "a")
 	})
 	public void testIgnoreValidationXml() {
 		Configuration<?> config = TestUtil.getConfigurationUnderTest();
@@ -87,7 +93,10 @@
 
 	@Test
 	@SpecAssertions({
-			@SpecAssertion(section = "4.4.6", id = "a")
+			@SpecAssertion(section = "4.4.6", id = "a"),
+			@SpecAssertion(section = "4.4.6", id = "l"),
+			@SpecAssertion(section = "7.1.1", id = "a"),
+			@SpecAssertion(section = "7.1.2", id = "a")
 	})
 	public void testPropertyConstraintDefinedInXml() {
 		Validator validator = TestUtil.getValidatorUnderTest();
@@ -107,7 +116,10 @@
 
 	@Test
 	@SpecAssertions({
-			@SpecAssertion(section = "4.4.6", id = "a")
+			@SpecAssertion(section = "4.4.6", id = "a"),
+			@SpecAssertion(section = "4.4.6", id = "l"),
+			@SpecAssertion(section = "7.1.1", id = "a"),
+			@SpecAssertion(section = "7.1.2", id = "a")
 	})
 	public void testFieldConstraintDefinedInXml() {
 		Validator validator = TestUtil.getValidatorUnderTest();
@@ -130,7 +142,10 @@
 
 	@Test
 	@SpecAssertions({
-			@SpecAssertion(section = "4.4.6", id = "a")
+			@SpecAssertion(section = "4.4.6", id = "a"),
+			@SpecAssertion(section = "4.4.6", id = "l"),
+			@SpecAssertion(section = "7.1.1", id = "a"),
+			@SpecAssertion(section = "7.1.2", id = "a")
 	})
 	public void testAnnotationDefinedConstraintApplies() {
 		Validator validator = TestUtil.getValidatorUnderTest();
@@ -152,7 +167,10 @@
 
 	@Test
 	@SpecAssertions({
-			@SpecAssertion(section = "4.4.6", id = "a")
+			@SpecAssertion(section = "4.4.6", id = "a"),
+			@SpecAssertion(section = "4.4.6", id = "l"),
+			@SpecAssertion(section = "7.1.1", id = "a"),
+			@SpecAssertion(section = "7.1.2", id = "a")
 	})
 	public void testCascadingConfiguredInXml() {
 		Validator validator = TestUtil.getValidatorUnderTest();

Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/XmlDefinedMessageInterpolator.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/XmlDefinedMessageInterpolator.java	2009-08-19 12:48:52 UTC (rev 17358)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/XmlDefinedMessageInterpolator.java	2009-08-19 12:49:16 UTC (rev 17359)
@@ -33,4 +33,10 @@
 	public String interpolate(String messageTemplate, Context context, Locale locale) {
 		return STATIC_INTERPOLATION_STRING;
 	}
+
+	public class NoDefaultConstructorInterpolator extends XmlDefinedMessageInterpolator {
+		public NoDefaultConstructorInterpolator(String foo) {
+
+		}
+	}
 }

Modified: 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.xml	2009-08-19 12:48:52 UTC (rev 17358)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/user-constraints.xml	2009-08-19 12:49:16 UTC (rev 17359)
@@ -52,7 +52,7 @@
             </constraint>
         </getter>
     </bean>
-    <constraint-definition annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.ConsistentUserInformation">
+    <constraint-definition annotation="ConsistentUserInformation">
         <validated-by include-existing-validators="false">
             <value>org.hibernate.jsr303.tck.tests.xmlconfiguration.CustomConsistentUserValidator</value>
         </validated-by>

Copied: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.xml (from rev 17356, beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-MessageInterpolatorSpecifiedInValidationXmlTest.xml)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.xml	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/validation-MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.xml	2009-08-19 12:49:16 UTC (rev 17359)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<validation-config
+        xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd">
+    <message-interpolator>org.hibernate.jsr303.tck.tests.xmlconfiguration.XmlDefinedMessageInterpolator.NoDefaultConstructorInterpolator</message-interpolator>
+</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-08-19 12:48:52 UTC (rev 17358)
+++ beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml	2009-08-19 12:49:16 UTC (rev 17359)
@@ -874,17 +874,17 @@
             <text>More than one constraint-mapping element can be present</text>
         </assertion>
         <assertion id="m">
-            <text>Mappings provided via Configuration.addMapping(InputString) are added to the list
+            <text>Mappings provided via Configuration.addMapping(InputStream) are added to the list
                 of mappings described via constraint-mapping</text>
         </assertion>
-        <assertion id="n">
-            <text>The namespace javax.validation is reserved for use by this specification</text>
+        <assertion id="n" testable="false">
+            <text>The namespace javax.validation for properties is reserved for use by this specification</text>
         </assertion>
-        <assertion id="o">
+        <assertion id="o" testable="false">
             <text>Properties defined via Configuration.addProperty(String, String) are added to the
                 properties defined via property</text>
         </assertion>
-        <assertion id="p">
+        <assertion id="p" testable="false">
             <text>If a property with the same name are defined in both XML and via the programmatic
                 API, the value provided via programmatic API has priority</text>
         </assertion>
@@ -1175,7 +1175,7 @@
         </assertion>
         <assertion id="e">
             <text>If the element represents an annotation, the annotation element is used to
-                represent the annotation and placed un- der element</text>
+                represent the annotation and placed under element</text>
         </assertion>
         <assertion id="f">
             <text>If the element represents an array of annotations, one or more annotation elements
@@ -1205,7 +1205,7 @@
                 of ConstraintValidator evaluated</text>
         </assertion>
         <assertion id="d">
-            <text>Annota- tion based ConstraintValidator come before XML based ConstraintValidatot
+            <text>Annotation based ConstraintValidator come before XML based ConstraintValidator
                 in the array</text>
         </assertion>
         <assertion id="e">



More information about the hibernate-commits mailing list