[hibernate-commits] Hibernate SVN: r16805 - in beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation: traversableresolver and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Jun 16 15:33:09 EDT 2009


Author: hardy.ferentschik
Date: 2009-06-16 15:33:09 -0400 (Tue, 16 Jun 2009)
New Revision: 16805

Added:
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Cloth.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Jacket.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Suit.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Trousers.java
Log:
Added traversable resolver tests

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java	2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,137 @@
+// $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.validation.traversableresolver;
+
+import java.lang.annotation.ElementType;
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.TraversableResolver;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.groups.Default;
+
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * @author Emmanuel Bernard
+ */
+//this test is specific to Hibernate Validator
+public class CachedTraversableResolverTest {
+	@Test
+	public void testCache() {
+		TraversableResolver resolver = new AskOnceTR();
+		Configuration<?> config = (Configuration<?>) Validation.byDefaultProvider()
+				.configure()
+				.traversableResolver( resolver );
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Suit suit = new Suit();
+		suit.setTrousers( new Trousers() );
+		suit.setJacket( new Jacket() );
+		suit.setSize( 3333 );
+		suit.getTrousers().setLength( 32321 );
+		suit.getJacket().setWidth( 432432 );
+		Validator v = factory.getValidator();
+		try {
+			v.validate( suit, Default.class, Cloth.class );
+		}
+		catch ( IllegalStateException e ) {
+			fail( "Traversable Called several times for a given object" );
+		}
+
+		v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
+		try {
+			v.validateProperty( suit, "size", Default.class, Cloth.class );
+		}
+		catch ( IllegalStateException e ) {
+			fail( "Traversable Called several times for a given object" );
+		}
+
+		v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
+		try {
+			v.validateValue( Suit.class, "size", 2, Default.class, Cloth.class );
+		}
+		catch ( IllegalStateException e ) {
+			fail( "Traversable Called several times for a given object" );
+		}
+	}
+
+	private static class AskOnceTR implements TraversableResolver {
+		private Set<Holder> askedReach = new HashSet<Holder>();
+		private Set<Holder> askedCascade = new HashSet<Holder>();
+
+		private boolean isTraversable(Set<Holder> asked, Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+			Holder h = new Holder( traversableObject, traversableProperty );
+			if ( asked.contains( h ) ) {
+				throw new IllegalStateException( "Called twice" );
+			}
+			asked.add( h );
+			return true;
+		}
+
+		public boolean isReachable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+			return isTraversable(
+					askedReach,
+					traversableObject,
+					traversableProperty,
+					rootBeanType,
+					pathToTraversableObject,
+					elementType
+			);
+		}
+
+		public boolean isCascadable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+			return isTraversable(
+					askedCascade,
+					traversableObject,
+					traversableProperty,
+					rootBeanType,
+					pathToTraversableObject,
+					elementType
+			);
+		}
+
+		public static class Holder {
+			Object NULL = new Object();
+			Object to;
+			String tp;
+
+			public Holder(Object traversableObject, String traversableProperty) {
+				to = traversableObject == null ? NULL : traversableObject;
+				tp = traversableProperty;
+			}
+
+			@Override
+			public int hashCode() {
+				return to.hashCode() + tp.hashCode();
+			}
+
+			@Override
+			public boolean equals(Object obj) {
+				if ( !( obj instanceof Holder ) ) {
+					return false;
+				}
+				Holder that = ( Holder ) obj;
+
+				return to != NULL && to == that.to && tp.equals( that.tp );
+			}
+		}
+	}
+}
\ No newline at end of file


Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Cloth.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Cloth.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Cloth.java	2009-06-16 19:33:09 UTC (rev 16805)
@@ -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.validation.traversableresolver;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public interface Cloth {
+}
\ No newline at end of file


Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Cloth.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Jacket.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Jacket.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Jacket.java	2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,37 @@
+// $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.validation.traversableresolver;
+
+import javax.validation.constraints.Max;
+
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Jacket {
+	Integer width;
+
+	@Max(30)
+	public Integer getWidth() {
+		return width;
+	}
+
+	public void setWidth(Integer width) {
+		this.width = width;
+	}
+}
\ No newline at end of file


Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Jacket.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java	2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,159 @@
+// $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.validation.traversableresolver;
+
+import java.lang.annotation.ElementType;
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.TraversableResolver;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class SnifferTraversableResolver implements TraversableResolver {
+	Set<String> reachPaths = new HashSet<String>();
+	Set<String> cascadePaths = new HashSet<String>();
+	Set<Call> reachCalls = new HashSet<Call>();
+	Set<Call> cascadeCalls = new HashSet<Call>();
+
+	public SnifferTraversableResolver(Suit suit) {
+		reachCalls.add( new Call( suit, "size", Suit.class, "", ElementType.FIELD ) );
+		reachCalls.add( new Call( suit, "trousers", Suit.class, "", ElementType.FIELD ) );
+		cascadeCalls.add( new Call( suit, "trousers", Suit.class, "", ElementType.FIELD ) );
+		reachCalls.add( new Call( suit.getTrousers(), "length", Suit.class, "trousers", ElementType.FIELD ) );
+		reachCalls.add( new Call( suit, "jacket", Suit.class, "", ElementType.METHOD ) );
+		cascadeCalls.add( new Call( suit, "jacket", Suit.class, "", ElementType.METHOD ) );
+		reachCalls.add( new Call( suit.getJacket(), "width", Suit.class, "jacket", ElementType.METHOD ) );
+	}
+
+	public Set<String> getReachPaths() {
+		return reachPaths;
+	}
+
+	public Set<String> getCascadePaths() {
+		return cascadePaths;
+	}
+
+	public boolean isTraversable(Set<Call> calls, Set<String> paths, Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+		String path = "";
+		if ( !( pathToTraversableObject == null || pathToTraversableObject.length() == 0 ) ) {
+			path = pathToTraversableObject + ".";
+		}
+		paths.add( path + traversableProperty );
+		Call call = new Call(
+				traversableObject, traversableProperty, rootBeanType, pathToTraversableObject, elementType
+		);
+		if ( !calls.contains( call ) ) {
+
+			throw new IllegalStateException( "Unexpected " + call.toString() );
+		}
+		return true;
+	}
+
+	public boolean isReachable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+		return isTraversable(
+				reachCalls,
+				reachPaths,
+				traversableObject,
+				traversableProperty,
+				rootBeanType,
+				pathToTraversableObject,
+				elementType
+		);
+	}
+
+	public boolean isCascadable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+		return isTraversable(
+				cascadeCalls,
+				cascadePaths,
+				traversableObject,
+				traversableProperty,
+				rootBeanType,
+				pathToTraversableObject,
+				elementType
+		);
+	}
+
+	private static final class Call {
+		private Object traversableObject;
+		private String traversableProperty;
+		private Class<?> rootBeanType;
+		private String pathToTraversableObject;
+		private ElementType elementType;
+
+		private Call(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+			this.traversableObject = traversableObject;
+			this.traversableProperty = traversableProperty;
+			this.rootBeanType = rootBeanType;
+			this.pathToTraversableObject = pathToTraversableObject;
+			this.elementType = elementType;
+		}
+
+		@Override
+		@SuppressWarnings("SimplifiableIfStatement")
+		public boolean equals(Object o) {
+			if ( this == o ) {
+				return true;
+			}
+			if ( o == null || getClass() != o.getClass() ) {
+				return false;
+			}
+
+			Call call = ( Call ) o;
+
+			if ( elementType != call.elementType ) {
+				return false;
+			}
+			if ( !pathToTraversableObject.equals( call.pathToTraversableObject ) ) {
+				return false;
+			}
+			if ( !rootBeanType.equals( call.rootBeanType ) ) {
+				return false;
+			}
+			if ( traversableObject != null ? !( traversableObject == call.traversableObject ) : call.traversableObject != null ) {
+				return false;
+			}
+			if ( !traversableProperty.equals( call.traversableProperty ) ) {
+				return false;
+			}
+
+			return true;
+		}
+
+		@Override
+		public int hashCode() {
+			int result = traversableObject != null ? traversableObject.hashCode() : 0;
+			result = 31 * result + traversableProperty.hashCode();
+			result = 31 * result + rootBeanType.hashCode();
+			result = 31 * result + pathToTraversableObject.hashCode();
+			result = 31 * result + elementType.hashCode();
+			return result;
+		}
+
+		@Override
+		public String toString() {
+			return "Call{" +
+					"traversableObject=" + traversableObject +
+					", traversableProperty='" + traversableProperty + '\'' +
+					", rootBeanType=" + rootBeanType +
+					", pathToTraversableObject='" + pathToTraversableObject + '\'' +
+					", elementType=" + elementType +
+					'}';
+		}
+	}
+}
\ No newline at end of file


Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Suit.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Suit.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Suit.java	2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,61 @@
+// $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.validation.traversableresolver;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.Valid;
+import javax.validation.GroupSequence;
+import javax.validation.groups.Default;
+
+/**
+ * @author Emmanuel Bernard
+ */
+ at GroupSequence( {Suit.class, Cloth.class })
+public class Suit {
+	@Max(value=50, groups = { Default.class, Cloth.class})
+	@Min(1)
+	private Integer size;
+	@Valid private Trousers trousers;
+	private Jacket jacket;
+
+	public Trousers getTrousers() {
+		return trousers;
+	}
+
+	public void setTrousers(Trousers trousers) {
+		this.trousers = trousers;
+	}
+
+	@Valid
+	public Jacket getJacket() {
+		return jacket;
+	}
+
+	public void setJacket(Jacket jacket) {
+		this.jacket = jacket;
+	}
+
+	public Integer getSize() {
+		return size;
+	}
+
+	public void setSize(Integer size) {
+		this.size = size;
+	}
+}
\ No newline at end of file


Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Suit.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java	2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,56 @@
+// $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.validation.traversableresolver;
+
+import javax.validation.Configuration;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.groups.Default;
+
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.Test;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class TraversableResolverTest {
+	@Test
+	public void testCorrectPathsAreRequested() {
+		Suit suit = new Suit();
+		suit.setTrousers( new Trousers() );
+		suit.setJacket( new Jacket() );
+		suit.setSize( 3333 );
+		suit.getTrousers().setLength( 32321 );
+		suit.getJacket().setWidth( 432432 );
+
+		SnifferTraversableResolver resolver = new SnifferTraversableResolver( suit );
+
+		// TODO - Investigate why this cast is needed with Java 5. In Java 6 there is no problem.
+		Configuration<?> config = (Configuration<?>) Validation.byDefaultProvider().configure().traversableResolver( resolver );
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator v = factory.getValidator();
+
+		//Raises an IllegalStateException if something goes wrong
+		v.validate( suit, Default.class, Cloth.class );
+
+		assertEquals( 5, resolver.getReachPaths().size() );
+		assertEquals( 2, resolver.getCascadePaths().size() );
+	}
+}
\ No newline at end of file


Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Trousers.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Trousers.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Trousers.java	2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,39 @@
+// $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.validation.traversableresolver;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Max;
+import javax.validation.groups.Default;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Trousers {
+	@Min(value=70, groups = {Default.class, Cloth.class})
+	@Max(value=220)
+	private Integer length;
+
+	public Integer getLength() {
+		return length;
+	}
+
+	public void setLength(Integer length) {
+		this.length = length;
+	}
+}
\ No newline at end of file


Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Trousers.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native




More information about the hibernate-commits mailing list