Author: hardy.ferentschik
Date: 2009-11-04 11:24:28 -0500 (Wed, 04 Nov 2009)
New Revision: 17911
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/ICompetition.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/IFixture.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Competition.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Fixture.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Game.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/GameDetail.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/PersonCompetition.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/TeamCompetition.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Competition.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Fixture.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Game.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/GameDetail.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/PersonCompetition.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/TeamCompetition.java
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/annotation-mappings.xml
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/xml-mappings.xml
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java
validator/trunk/hibernate-validator/src/test/suite/unit-tests.xml
Log:
HV-265 Added tests
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java 2009-11-04
16:01:22 UTC (rev 17910)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -23,6 +23,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import javax.validation.Configuration;
import javax.validation.ConstraintViolation;
import javax.validation.Path;
import javax.validation.Validation;
@@ -55,14 +56,16 @@
public static Validator getValidator() {
if ( hibernateValidator == null ) {
- HibernateValidatorConfiguration configuration = Validation
- .byProvider( HibernateValidator.class )
- .configure();
+ Configuration configuration = getConfiguration();
hibernateValidator = configuration.buildValidatorFactory().getValidator();
}
return hibernateValidator;
}
+ public static Configuration<?> getConfiguration() {
+ return Validation.byProvider( HibernateValidator.class ).configure();
+ }
+
/**
* @param path The path to the xml file which should server as
<code>validation.xml</code> for the returned
* <code>Validator</code>.
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java 2009-11-04
16:01:22 UTC (rev 17910)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -22,7 +22,6 @@
import java.util.Set;
import javax.validation.Configuration;
import javax.validation.ConstraintViolation;
-import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import javax.validation.groups.Default;
@@ -30,6 +29,8 @@
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
+import org.hibernate.validator.util.TestUtil;
+
/**
* @author Hardy Ferentschik
*/
@@ -41,7 +42,7 @@
*/
public void testConstraintInheritanceWithXmlConfiguration() {
- final Configuration<?> configuration =
Validation.byDefaultProvider().configure();
+ final Configuration<?> configuration = TestUtil.getConfiguration();
configuration.addMapping( XmlMappingTest.class.getResourceAsStream(
"mapping.xml" ) );
final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
@@ -58,7 +59,7 @@
*/
public void testListOfString() {
- final Configuration<?> configuration =
Validation.byDefaultProvider().configure();
+ final Configuration<?> configuration = TestUtil.getConfiguration();
configuration.addMapping( XmlMappingTest.class.getResourceAsStream(
"properties-mapping.xml" ) );
final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
@@ -82,14 +83,14 @@
*/
public void testInterfaceConfiguration() {
- final Configuration<?> configuration =
Validation.byDefaultProvider().configure();
+ final Configuration<?> configuration = TestUtil.getConfiguration();
configuration.addMapping( XmlMappingTest.class.getResourceAsStream(
"my-interface-mapping.xml" ) );
final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
final Validator validator = validatorFactory.getValidator();
- final Set<ConstraintViolation<MyInterfaceImpl>> violations =
validator.validate( new MyInterfaceImpl());
+ final Set<ConstraintViolation<MyInterfaceImpl>> violations =
validator.validate( new MyInterfaceImpl() );
- assertEquals( violations.size(), 1);
+ assertEquals( violations.size(), 1 );
}
@Test
@@ -98,29 +99,29 @@
*/
public void testInterfaceImplementationConfiguration() {
- final Configuration<?> configuration =
Validation.byDefaultProvider().configure();
+ final Configuration<?> configuration = TestUtil.getConfiguration();
configuration.addMapping( XmlMappingTest.class.getResourceAsStream(
"my-interface-impl-mapping.xml" ) );
final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
final Validator validator = validatorFactory.getValidator();
- final Set<ConstraintViolation<MyInterfaceImpl>> violations =
validator.validate( new MyInterfaceImpl());
+ final Set<ConstraintViolation<MyInterfaceImpl>> violations =
validator.validate( new MyInterfaceImpl() );
- assertEquals( violations.size(), 1);
+ assertEquals( violations.size(), 1 );
}
-
+
@Test
/**
* HV-263
*/
public void testEmptyInterfaceConfiguration() {
- final Configuration<?> configuration =
Validation.byDefaultProvider().configure();
+ final Configuration<?> configuration = TestUtil.getConfiguration();
configuration.addMapping( XmlMappingTest.class.getResourceAsStream(
"empty-my-interface-mapping.xml" ) );
final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
final Validator validator = validatorFactory.getValidator();
- final Set<ConstraintViolation<MyInterfaceImpl>> violations =
validator.validate( new MyInterfaceImpl());
+ final Set<ConstraintViolation<MyInterfaceImpl>> violations =
validator.validate( new MyInterfaceImpl() );
- assertEquals( violations.size(), 0);
- }
+ assertEquals( violations.size(), 0 );
+ }
}
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/ICompetition.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/ICompetition.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/ICompetition.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,20 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration;
+
+public interface ICompetition {}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/ICompetition.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/IFixture.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/IFixture.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/IFixture.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,22 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration;
+
+public interface IFixture {
+ ICompetition getCompetition();
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/IFixture.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,130 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.constraints.NotNull;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.FileAssert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.util.TestUtil;
+
+
+/**
+ * See HV-265
+ *
+ * @author Hardy Ferentschik
+ */
+public class InheritanceMappingsTest {
+
+ @Test
+ public void defaultConfigurationNoExplicitAnnotationDefinition1() {
+ validateAnnotatedFixture(
+ new org.hibernate.validator.xml.mixedconfiguration.annotation.PersonCompetition(),
+ configure()
+ );
+ }
+
+ @Test
+ public void defaultConfigurationNoExplicitAnnotationDefinition2() {
+ validateAnnotatedFixture(
+ new org.hibernate.validator.xml.mixedconfiguration.annotation.TeamCompetition(),
+ configure()
+ );
+ }
+
+ @Test
+ public void customConfigurationNoExplicitAnnotationDefinition1() {
+ validateAnnotatedFixture(
+ new org.hibernate.validator.xml.mixedconfiguration.annotation.PersonCompetition(),
+ configure( "annotation-mappings.xml" )
+ );
+ }
+
+ @Test
+ public void customConfigurationNoExplicitAnnotationDefinition2() {
+ validateAnnotatedFixture(
+ new org.hibernate.validator.xml.mixedconfiguration.annotation.TeamCompetition(),
+ configure( "annotation-mappings.xml" )
+ );
+ }
+
+ @Test
+ public void customConfigurationExplicitXmlDefinition() {
+ validateXmlDefinedFixture(
+ new org.hibernate.validator.xml.mixedconfiguration.xml.PersonCompetition(),
+ configure( "xml-mappings.xml" )
+ );
+ }
+
+ @Test
+ public void customConfigurationNoExplicitXmlDefinition() {
+ validateXmlDefinedFixture(
+ new org.hibernate.validator.xml.mixedconfiguration.xml.TeamCompetition(),
+ configure( "xml-mappings.xml" )
+ );
+ }
+
+ private Validator configure() {
+ return TestUtil.getValidator();
+ }
+
+ private Validator configure(String mappingsUrl) {
+ Configuration<?> configuration = TestUtil.getConfiguration();
+ configuration.addMapping( InheritanceMappingsTest.class.getResourceAsStream(
mappingsUrl ) );
+
+ ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
+ return validatorFactory.getValidator();
+ }
+
+ private void validateFixture(IFixture fixture, Validator validator) {
+ Set<ConstraintViolation<IFixture>> violations = validator.validate( fixture
);
+
+ for ( ConstraintViolation<IFixture> violation : violations ) {
+ if ( violation.getLeafBean() instanceof ICompetition
+ && "detail.competition.name".equals(
violation.getPropertyPath().toString() ) ) {
+ assertEquals( violation.getLeafBean(), fixture.getCompetition() );
+ Annotation annotation = ( ( Annotation )
violation.getConstraintDescriptor().getAnnotation() );
+ assertEquals( annotation.annotationType(), NotNull.class );
+ return;
+ }
+ }
+ fail( "@NotNull constraint violation for 'detail.competition.name' not
detected" );
+ }
+
+ private void
validateAnnotatedFixture(org.hibernate.validator.xml.mixedconfiguration.annotation.Competition
competition,
+ Validator validator) {
+ org.hibernate.validator.xml.mixedconfiguration.annotation.Fixture fixture = new
org.hibernate.validator.xml.mixedconfiguration.annotation.Fixture();
+ fixture.setCompetition( competition );
+ validateFixture( fixture, validator );
+ }
+
+ private void
validateXmlDefinedFixture(org.hibernate.validator.xml.mixedconfiguration.xml.Competition
competition,
+ Validator validator) {
+ org.hibernate.validator.xml.mixedconfiguration.xml.Fixture fixture = new
org.hibernate.validator.xml.mixedconfiguration.xml.Fixture();
+ fixture.setCompetition( competition );
+ validateFixture( fixture, validator );
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Competition.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Competition.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Competition.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,46 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.annotation;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+import org.hibernate.validator.xml.mixedconfiguration.ICompetition;
+
+public abstract class Competition implements ICompetition {
+
+ @NotNull
+ @Size(min = 1)
+ private String name;
+
+ public Competition() {
+ super();
+ }
+
+ public Competition(String name) {
+ setName( name );
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Competition.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Fixture.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Fixture.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Fixture.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,31 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.annotation;
+
+import org.hibernate.validator.xml.mixedconfiguration.IFixture;
+
+public class Fixture extends Game implements IFixture {
+
+ public Fixture() {
+ super();
+ }
+
+ public Fixture(Competition competition) {
+ super( competition );
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Fixture.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Game.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Game.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Game.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,48 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.annotation;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+
+public abstract class Game {
+
+ @NotNull
+ @Valid
+ private GameDetail detail;
+
+ private Game(GameDetail detail) {
+ this.detail = detail;
+ }
+
+ public Game() {
+ this( new GameDetail() );
+ }
+
+ public Game(Competition competition) {
+ this( new GameDetail( competition ) );
+ }
+
+ public Competition getCompetition() {
+ return detail.getCompetition();
+ }
+
+ public void setCompetition(Competition competition) {
+ detail.setCompetition( competition );
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Game.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/GameDetail.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/GameDetail.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/GameDetail.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,44 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.annotation;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+
+public class GameDetail {
+
+ @NotNull
+ @Valid
+ private Competition competition;
+
+ public GameDetail() {
+ super();
+ }
+
+ public GameDetail(Competition competition) {
+ setCompetition( competition );
+ }
+
+ public Competition getCompetition() {
+ return competition;
+ }
+
+ public void setCompetition(Competition competition) {
+ this.competition = competition;
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/GameDetail.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/PersonCompetition.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/PersonCompetition.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/PersonCompetition.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,29 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.annotation;
+
+public class PersonCompetition extends Competition {
+
+ public PersonCompetition() {
+ super();
+ }
+
+ public PersonCompetition(String name) {
+ super( name );
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/PersonCompetition.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/TeamCompetition.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/TeamCompetition.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/TeamCompetition.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,28 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.annotation;
+
+public class TeamCompetition extends Competition {
+ public TeamCompetition() {
+ super();
+ }
+
+ public TeamCompetition(String name) {
+ super( name );
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/TeamCompetition.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Competition.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Competition.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Competition.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,41 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.xml;
+
+import org.hibernate.validator.xml.mixedconfiguration.ICompetition;
+
+public abstract class Competition implements ICompetition {
+
+ private String name;
+
+ public Competition() {
+ super();
+ }
+
+ public Competition(String name) {
+ setName( name );
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Competition.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Fixture.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Fixture.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Fixture.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,36 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.xml;
+
+import org.hibernate.validator.xml.mixedconfiguration.IFixture;
+
+public class Fixture extends Game implements IFixture {
+
+ public Fixture() {
+ super();
+ }
+
+ public Fixture(Competition competition) {
+ super( competition );
+ }
+
+ @Override
+ public void setCompetition(Competition competition) {
+ super.setCompetition( competition );
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Fixture.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Game.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Game.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Game.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,43 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.xml;
+
+public abstract class Game {
+
+ private GameDetail detail;
+
+ private Game(GameDetail detail) {
+ this.detail = detail;
+ }
+
+ public Game() {
+ this( new GameDetail() );
+ }
+
+ public Game(Competition competition) {
+ this( new GameDetail( competition ) );
+ }
+
+ public Competition getCompetition() {
+ return detail.getCompetition();
+ }
+
+ public void setCompetition(Competition competition) {
+ detail.setCompetition( competition );
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Game.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/GameDetail.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/GameDetail.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/GameDetail.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,39 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.xml;
+
+public class GameDetail {
+
+ private Competition competition;
+
+ public GameDetail() {
+ super();
+ }
+
+ public GameDetail(Competition competition) {
+ setCompetition( competition );
+ }
+
+ public Competition getCompetition() {
+ return competition;
+ }
+
+ public void setCompetition(Competition competition) {
+ this.competition = competition;
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/GameDetail.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/PersonCompetition.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/PersonCompetition.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/PersonCompetition.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,29 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.xml;
+
+public class PersonCompetition extends Competition {
+
+ public PersonCompetition() {
+ super();
+ }
+
+ public PersonCompetition(String name) {
+ super( name );
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/PersonCompetition.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/TeamCompetition.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/TeamCompetition.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/TeamCompetition.java 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,29 @@
+// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml.mixedconfiguration.xml;
+
+public class TeamCompetition extends Competition {
+
+ public TeamCompetition() {
+ super();
+ }
+
+ public TeamCompetition(String name) {
+ super( name );
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/TeamCompetition.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/annotation-mappings.xml
===================================================================
---
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/annotation-mappings.xml
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/annotation-mappings.xml 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<constraint-mappings
+
xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+
http://jboss.org/xml/ns/javax/validation/mapping
+ validation-mapping-1.0.xsd">
+
+</constraint-mappings>
Property changes on:
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/annotation-mappings.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/xml-mappings.xml
===================================================================
---
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/xml-mappings.xml
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/xml-mappings.xml 2009-11-04
16:24:28 UTC (rev 17911)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<constraint-mappings
+
xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+
http://jboss.org/xml/ns/javax/validation/mapping
+ validation-mapping-1.0.xsd">
+
+
<default-package>org.hibernate.validator.xml.mixedconfiguration.xml</default-package>
+
+ <bean class="Competition" ignore-annotations="true">
+ <field name="name">
+ <constraint
annotation="javax.validation.constraints.NotNull"/>
+ <constraint annotation="javax.validation.constraints.Size">
+ <element name="min">1</element>
+ </constraint>
+ </field>
+ </bean>
+ <bean class="PersonCompetition"
ignore-annotations="true"/>
+ <!--bean class="TeamCompetition"/-->
+
+ <bean class="Game" ignore-annotations="true">
+ <field name="detail">
+ <valid/>
+ <constraint
annotation="javax.validation.constraints.NotNull"/>
+ </field>
+ </bean>
+
+ <bean class="GameDetail" ignore-annotations="true">
+ <field name="competition">
+ <valid/>
+ <constraint
annotation="javax.validation.constraints.NotNull"/>
+ </field>
+ </bean>
+ <bean class="Fixture"/>
+
+</constraint-mappings>
Property changes on:
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/xml-mappings.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: validator/trunk/hibernate-validator/src/test/suite/unit-tests.xml
===================================================================
--- validator/trunk/hibernate-validator/src/test/suite/unit-tests.xml 2009-11-04 16:01:22
UTC (rev 17910)
+++ validator/trunk/hibernate-validator/src/test/suite/unit-tests.xml 2009-11-04 16:24:28
UTC (rev 17911)
@@ -16,6 +16,7 @@
<package name="org.hibernate.validator.util"/>
<package
name="org.hibernate.validator.util.annotationfactory"/>
<package name="org.hibernate.validator.xml"/>
+ <package
name="org.hibernate.validator.xml.mixedconfiguration"/>
</packages>
</test>
</suite>
\ No newline at end of file