Author: hardy.ferentschik
Date: 2009-08-24 08:42:58 -0400 (Mon, 24 Aug 2009)
New Revision: 17402
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/MissingMandatoryElementTest.java
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-MissingMandatoryElementTest.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-MissingMandatoryElementTest.xml
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/GroupIsNotAllowedAsElementNameTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/MessageIsNotAllowedAsElementNameTest.java
Log:
added test for xml configuration
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/GroupIsNotAllowedAsElementNameTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/GroupIsNotAllowedAsElementNameTest.java 2009-08-24
12:42:30 UTC (rev 17401)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/GroupIsNotAllowedAsElementNameTest.java 2009-08-24
12:42:58 UTC (rev 17402)
@@ -48,7 +48,7 @@
public void testGroupIsNotAllowedAsElementName() {
try {
TestUtil.getValidatorUnderTest();
- fail();
+ fail("Validator creation should have failed since <element
name=\"groups\"> was used.");
}
catch ( ValidationException e ) {
// success
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/MessageIsNotAllowedAsElementNameTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/MessageIsNotAllowedAsElementNameTest.java 2009-08-24
12:42:30 UTC (rev 17401)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/MessageIsNotAllowedAsElementNameTest.java 2009-08-24
12:42:58 UTC (rev 17402)
@@ -47,7 +47,7 @@
public void testMessageIsNotAllowedAsElementName() {
try {
TestUtil.getValidatorUnderTest();
- fail();
+ fail("Validator creation should have failed since <element
name=\"message\"> was used.");
}
catch ( ValidationException e ) {
// success
Copied:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/MissingMandatoryElementTest.java
(from rev 17380,
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/GroupIsNotAllowedAsElementNameTest.java)
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/MissingMandatoryElementTest.java
(rev 0)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/MissingMandatoryElementTest.java 2009-08-24
12:42:58 UTC (rev 17402)
@@ -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.xmlconfiguration.constraintdeclaration;
+
+
+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;
+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 = "validation-MissingMandatoryElementTest.xml")
+@Resource(source = "package-constraints-MissingMandatoryElementTest.xml",
+ destination =
"WEB-INF/classes/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-MissingMandatoryElementTest.xml")
+public class MissingMandatoryElementTest extends AbstractTest {
+
+ @Test
+ @SpecAssertion(section = "7.1.1.4", id = "h")
+ public void testMissingMandatoryElementInConstraintDeclaration() {
+ try {
+ TestUtil.getValidatorUnderTest();
+ fail("Creating the validator should have failed since the constraint declaration
in xml is incomplete.");
+ }
+ catch ( ValidationException e ) {
+ // success
+ System.err.println( e.getMessage() );
+ }
+ }
+}
\ No newline at end of file
Copied:
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-MissingMandatoryElementTest.xml
(from rev 17381,
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ConfigurationViaXmlAndAnnotationsTest.xml)
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-MissingMandatoryElementTest.xml
(rev 0)
+++
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-MissingMandatoryElementTest.xml 2009-08-24
12:42:58 UTC (rev 17402)
@@ -0,0 +1,13 @@
+<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.constraintdeclaration</default-package>
+ <bean class="Package" ignore-annotations="false">
+ <field name="maxWeight">
+ <!-- Using Min constraint without specifying the mandatory value
parameter. Using this mapping
+ should throw an exception
+ -->
+ <constraint annotation="javax.validation.constraints.Min"/>
+ </field>
+ </bean>
+</constraint-mappings>
\ No newline at end of file
Copied:
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-MissingMandatoryElementTest.xml
(from rev 17390,
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingTest.xml)
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-MissingMandatoryElementTest.xml
(rev 0)
+++
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-MissingMandatoryElementTest.xml 2009-08-24
12:42:58 UTC (rev 17402)
@@ -0,0 +1,6 @@
+<?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/configu...
validation-configuration-1.0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
<constraint-mapping>/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-MissingMandatoryElementTest.xml</constraint-mapping>
+</validation-config>
\ No newline at end of file