Author: hardy.ferentschik
Date: 2009-08-31 09:54:12 -0400 (Mon, 31 Aug 2009)
New Revision: 17453
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/PrePosting.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java
Removed:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingImplicitOverrideTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingWithAnnotationTest.java
Log:
Test package refactoring to further structure TCK tests
Deleted:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingImplicitOverrideTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingImplicitOverrideTest.java 2009-08-31
13:53:12 UTC (rev 17452)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingImplicitOverrideTest.java 2009-08-31
13:54:12 UTC (rev 17453)
@@ -1,57 +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.xmlconfiguration.constraintdeclaration;
-
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-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 org.testng.annotations.Test;
-
-import org.hibernate.jsr303.tck.util.TestUtil;
-import static
org.hibernate.jsr303.tck.util.TestUtil.assertCorrectConstraintViolationMessages;
-import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-@Artifact(artifactType = ArtifactType.JSR303)
-@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
-@ValidationXml(value =
"validation-ClassLevelOverridingImplicitOverrideTest.xml")
-@Resource(source =
"package-constraints-ClassLevelOverridingImplicitOverrideTest.xml",
- destination =
"WEB-INF/classes/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml")
-public class ClassLevelOverridingImplicitOverrideTest extends AbstractTest {
-
- @Test
- @SpecAssertion(section = "7.1.1.1", id = "b")
- public void testIgnoreAnnotationsFromEnclosingBeanIsApplied() {
- Validator validator = TestUtil.getValidatorUnderTest();
- Package p = new Package();
- Set<ConstraintViolation<Package>> violations = validator.validate( p );
-
- assertCorrectNumberOfViolations( violations, 1 );
- assertCorrectConstraintViolationMessages( violations, "ValidPackage defined in
XML" );
- }
-}
\ No newline at end of file
Deleted:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingWithAnnotationTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingWithAnnotationTest.java 2009-08-31
13:53:12 UTC (rev 17452)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingWithAnnotationTest.java 2009-08-31
13:54:12 UTC (rev 17453)
@@ -1,64 +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.xmlconfiguration.constraintdeclaration;
-
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-import javax.validation.groups.Default;
-
-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 org.testng.annotations.Test;
-
-import org.hibernate.jsr303.tck.util.TestUtil;
-import static
org.hibernate.jsr303.tck.util.TestUtil.assertCorrectConstraintViolationMessages;
-import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-@Artifact(artifactType = ArtifactType.JSR303)
-@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
-@ValidationXml(value =
"validation-ClassLevelOverridingWithAnnotationTest.xml")
-@Resource(source =
"package-constraints-ClassLevelOverridingWithAnnotationTest.xml",
- destination =
"WEB-INF/classes/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingWithAnnotationTest.xml")
-public class ClassLevelOverridingWithAnnotationTest extends AbstractTest {
-
- @Test
- @SpecAssertions({
- @SpecAssertion(section = "7.1.1.1", id = "a"),
- @SpecAssertion(section = "7.1.1.1", id = "d")
- })
- public void testClassLevelAnnotationsApplied() {
- Validator validator = TestUtil.getValidatorUnderTest();
- Package p = new Package();
- Set<ConstraintViolation<Package>> violations = validator.validate( p );
-
- assertCorrectNumberOfViolations( violations, 2 );
- assertCorrectConstraintViolationMessages(
- violations, "ValidPackage defined in XML", "ValidPackage defined as
annotation"
- );
- }
-}
\ No newline at end of file
Copied:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/PrePosting.java
(from rev 17449,
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/PrePosting.java)
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/PrePosting.java
(rev 0)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/PrePosting.java 2009-08-31
13:54:12 UTC (rev 17453)
@@ -0,0 +1,24 @@
+// $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.classlevel;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface PrePosting {
+}
Copied:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java
(from rev 17449,
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ValidPackage.java)
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java
(rev 0)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java 2009-08-31
13:54:12 UTC (rev 17453)
@@ -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.xmlconfiguration.constraintdeclaration.classlevel;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+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;
+import javax.validation.Payload;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Constraint(validatedBy = ValidPackage.ValidPackageValidator.class)
+@Documented
+@Target({ METHOD, FIELD, TYPE })
+@Retention(RUNTIME)
+public @interface ValidPackage {
+ public abstract String message() default "User information is not
consistent.";
+
+ public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends Payload>[] payload() default { };
+
+ public class ValidPackageValidator implements ConstraintValidator<ValidPackage,
Package> {
+
+ public void initialize(ValidPackage parameters) {
+ }
+
+ public boolean isValid(Package p, 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/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native